Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i am looking for auto attach htm generated file to email form as attachment in a webform

code of the webform

XML
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register Assembly="GradientPanel" Namespace="BXSW.SLControls" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>SMTP Demonstration</title>
</head>
<body style="font-size: medium; font-family: Arial; color: navy;" bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" text="#000099">
    <form id="form1" runat="server">
    <div>
        <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
            <tr>
                <td height="60" valign="bottom">
                    <cc1:GradientPanel ID="GradientPanel1" runat="server" Direction="Vertical" EndColor="DarkGray"
                        Font-Bold="True" Font-Names="Arial" Font-Size="Large" ForeColor="Black" Height="60px"
                        StartColor="LightSteelBlue">
                        <br />
                        &nbsp; &nbsp;&nbsp; ClaimForm Email
                    </cc1:GradientPanel>
                    <br />
                </td>
            </tr>
            <tr>
                <td height="100%" valign="top">
                    <table style="width: 100%">
                        <tr>
                            <td align="right" style="width: 20%; height: 9px" valign="top">
                                &nbsp; To:&nbsp;
                            </td>
                            <td style="width: 100%; height: 9px" valign="top">
                                &nbsp;
                                <asp:TextBox ID="txtTo" runat="server" Width="432px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align="right" height="10" style="width: 20%" valign="top">
                                &nbsp; From:&nbsp;
                            </td>
                            <td height="20" style="width: 100%" valign="top">
                                &nbsp;
                                <asp:TextBox ID="txtFrom" runat="server" Width="432px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align="right" height="10" style="width: 20%" valign="top">
                                &nbsp; CC:&nbsp;
                            </td>
                            <td height="20" style="width: 100%" valign="top">
                                &nbsp;
                                <asp:TextBox ID="txtCC" runat="server" Width="432px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align="right" height="10" style="width: 20%" valign="top">
                                &nbsp; Subject:&nbsp;
                            </td>
                            <td height="20" style="width: 100%" valign="top">
                                &nbsp;
                                <asp:TextBox ID="txtSubject" runat="server" Width="432px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align="right" height="10" style="width: 20%" valign="top">
                                &nbsp; Message:&nbsp;
                            </td>
                            <td height="20" style="width: 100%" valign="top">
                                &nbsp;
                                <asp:TextBox ID="txtMessage" runat="server" Height="216px" TextMode="MultiLine" Width="432px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align="right" height="10" style="width: 20%" valign="top">
                                &nbsp; Attachments:&nbsp;
                            </td>
                            <td height="20" style="width: 100%" valign="top">
                                &nbsp;&nbsp;<asp:FileUpload ID="fileAttachments" runat="server" Width="520px" /></td>
                        </tr>
                        <tr>
                            <td align="right" style="width: 20%; height: 20px" valign="top">
                            </td>
                            <td style="width: 100%; height: 20px" valign="top">
                                &nbsp;
                                <asp:Button ID="btnClear" runat="server" Text="Clear" />
                                <asp:Button ID="btnSend" runat="server" Text="Send" /></td>
                        </tr>
                    </table>
                    </td>
            </tr>
        </table>

    </div>
    </form>
</body>
</html>
Posted
Comments
AmitGajjar 13-Dec-12 6:41am    
You need to store your auto generated html file in some temporary folder and then you can process for attaching file in the SMTP email.
nikolas_ar 13-Dec-12 7:38am    
I did that and also i have the email form using smtp.How can the file automatic insert itself as attachement?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900