Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Hayrah Burki   on Jul 15 In Asp.net Category.

  
Question Answered By: Daw Boonliang   on Jul 15

You have to put that code inside an event handler like Page_Load, or a
button click, in this way:


Sub btn_Click(sender as Object, e as System.EventArgs)

If request.form("EmailAddress") <> ""
Dim mail  As New MailMessage
mail.From = "youraddress@..."
mail.To = request.form("EmailAddress")
mail.Subject = "Message sent using ASP.NET and CDONTS"
mail.Body = "HTML Message sent from ASPFree.com using ASP.NET
and Cdonts<br><a href='http://aspfree.com/aspnet/email.aspx'>Wonder how
this is done?</a><br><br><a
href='http://aspfree.com/aspnet/setupcdonts.aspx'>Wonder How to setup
CDONTS?</a>"
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "LocalServerName"
SmtpMail.Send(mail)
End If
End Sub

Then when you define the button (<input>) you should use
OnServerClick="btn_Click" or if you use a Button webcontrol
(<asp:Button>) define the OnClick event handler

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Question about how to send mail using Asp.net Or get search suggestion and latest updates.


Tagged: