System.Web.Mail question

  • Thread starter Thread starter Adrian
  • Start date Start date
Just leave server blank if using CDONTS:

Sub Button1_Click(sender As Object, e As EventArgs)
Try
' Build a MailMessage
Dim mailMessage As System.Web.Mail.MailMessage = New
System.Web.Mail.MailMessage
mailMessage.From = TextBox2.Text
mailMessage.To = TextBox1.Text
mailMessage.Subject = TextBox3.Text
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text
mailMessage.Body = TextBox4.Text

System.Web.Mail.SmtpMail.SmtpServer = ""
System.Web.Mail.SmtpMail.Send(mailMessage)

Label2.Text = "Your Mail was sent."
Catch exp as Exception
Label2.Text = "There was and error Sending the mail: " &
exp.Message
End Try
End Sub


Windows Win2k, Win XP Pro and Win2003 users - CDOSYS comes installed on
Windows 2000, Windows XP Pro, and Windows 2003.

Windows NT4 and Win2k users - IIS 4 and 5 on NT4 and Win2k installs the
CDONTS email component by default, but you need the SMTP server that
comes with IIS installed on the web server as well (This is the email
component that most web hosts will use).

Windows 9x users - I'm afraid Windows 98 does not support the CDOSYS or
CDONTS email components so... good luck.
 
Back
Top