Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hi i am looking for auto attach htm generated file to email form as attachment in a webform
 
code of the webform
 
<%@ 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 12-Dec-12 23:57pm
Comments
@AmitGajjar at 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 at 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)

  Print Answers RSS
0 Nirav Prabtani 298
1 OriginalGriff 289
2 Sergey Alexandrovich Kryukov 225
3 _Amy 165
4 Richard MacCutchan 135
0 OriginalGriff 7,799
1 Sergey Alexandrovich Kryukov 6,966
2 Maciej Los 3,994
3 Peter Leow 3,708
4 CHill60 2,742


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 13 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100