Monday, February 07, 2005

SMTP

Found this great web site http://www.systemwebmail.com/ which contains all the FAQ on SMTP in dotnet.

Previously, I encounter problem sending mail from SMTP server in my asp.net application. The reason being I have selected an SMTP server which does not allow relaying. After I set to the correct SMTP, I have no problem sending email.

This is my code

Dim mail As New MailMessage
mail.From = "yourname@email.com"
mail.To = "cust@123.com"
mail.Subject = "some subject"
mail.Priority = MailPriority.High
mail.BodyFormat = MailFormat.Text
mail.Body = "some message"



Try
SmtpMail.SmtpServer = "mail server ip address" //put ip address here
SmtpMail.Send(mail)
Catch ex As Exception
Throw ex
End Try



0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home