Thursday, May 13, 2004 - Posts

Sending Mail using c#

Hi all,

So yet again i'm bizzy with the project and i was trying to send some mail witch is very easy just do the following:

//Make the Mail Message and put some info in it
System.Web.Mail.MailMessage MMessage =
new System.Web.Mail.MailMessage();
MMessage.To = warstar-web@gmx.net;
MMessage.From = noreply@kapperkapper.nl;
MMessage.Body = String.Format("Key: {0}",status);
MMessage.Subject = "Registratie";
//Set the Mail server and send the message
System.Web.Mail.SmtpMail.SmtpServer = "mail.home.nl";
System.Web.Mail.SmtpMail.Send(MMessage);

It's very easy and works :) i'm sure that you must set the SmtpServer but i did because i don't have a working one running localhost.