0
Reply

Sending Emails using ASP

Mandla Tshili

Mandla Tshili

Mar 6 2008 5:23 AM
1.9k
Hello

I need to link my Gridview button to a fucntion that sends emails which is found in a vb page but am failing to do so whan i try calling it.Please help


My Function
Protected Function Send_Email(ByVal drwNumber As String) As String
       
        Dim message As New System.Net.Mail.MailMessage("text1.text", "text2.text")
        message.Subject = "Image Order"
        message.Body = "Please send me the following Image : "

        Dim smtp As New System.Net.Mail.SmtpClient("localhost")
        smtp.Send(message)
      
    End Function

My Gridview Link

                <asp:TemplateField HeaderText="Order"> 
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
                                <ItemTemplate>
                                      <asp:Hyperlink ID="Hyperlink1" Text = "Order"   CssClass="CommandButton" ToolTip="Click to Order." NavigateUrl='<%# Send_Email(Eval("drwNumber")) %>' Runat="server">
                                      </asp:Hyperlink>
                                </ItemTemplate>                         
                </asp:TemplateField>