public static void SendMailMessage(string Hostname, int Portno, string @from, string recepient, string bcc, string cc, string subject, string body)
{
try
{
// Instantiate a new instance of MailMessage
MailMessage EmailMessage = new MailMessage();
EmailMessage.From = new MailAddress(@from);
EmailMessage.To.Add(new MailAddress(recepient));
EmailMessage.Subject = subject;
EmailMessage.Body = body;
EmailMessage.IsBodyHtml = true;
EmailMessage.Priority = MailPriority.Normal;
SmtpClient MyClient = new SmtpClient();
MyClient.Host = Hostname;
MyClient.Port = Portno;
MyClient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
...
Go to the complete details ...