Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send mail(smtp) using coding?

Status
Not open for further replies.

whloo

Programmer
Apr 14, 2003
168
SG
hi,

i want to send mail in my .aspx application.
i have a smtp mail server.
anyone have sample code that i can reference?
thanks!

Regards,
weihann.
 
System.Web.Mail.MailMessage _msg = new System.Web.Mail.MailMessage()

_msg.To = "foo@foowerx.com";
_msg.From = "otherfoo@foowerx.com";
_msg.Subject = "guess what?... FOO!!!";
_msg.Body = "This is a test for foo!";
_msg.BodyFormat = System.Web.Mail.MailFormat.Html;

System.Web.Mail.SmtpMail.SmtpServer = "[smtpserver goes here]";
System.Web.Mail.SmtpMail.Send(_msg);

Hope that's what you're lookin' for =D

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top