- Posted by Admin on April 7, 2009
You can use the below class to send the emails using asp.net form or any windows based .net applications. This implements the SMTP client to send email.
public class MyOwnSMTP
{
public void SendMail(string From, string To, string Sub, string Body)
{
MailMessage Email = new MailMessage(From, To, Sub, Body);
Email.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient(SMTP server host or IP, 25 or 584);
smtp.Credentials = new System.Net.NetworkCredential("email address", "password");
smtp.Send(Email);
}
}
SMTP server hostname : The host name of your mail server. E.G. servers.a2zorkut.com
EMail address: Any email address hosted under the mail server at servers.a2zorkut.com
Password: Password of the above email address
From: From email address
To : To email address
Sub : Subject of the email to be sent.
Body: Body of the email to be sent.