Monday, May 28, 2012

Email Configuraton setting Coding using C#

 MailSetting ()

{
SmtpClient mailClient = new SmtpClient();

MailMessage email = new MailMessage("busadmin@kryptos.in", txtContactemail.Text);

email.Bcc.Add("vinitha.k@kryptos.in");

email.Subject = "Registration Details for VAR";

email.IsBodyHtml = true;

email.Body = "<html><body><table><tr><td>Dear Partner,</td></tr><tr><td></td></tr><tr><td>Greetings!.</td></tr><tr><td>Please find the log in details for VAR Website Access<br/></td></tr><tr><td></td></tr><tr><td>UserName:" + strUsername + "</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Password:" + strPassword + "</td></tr><tr><td>Kindly acknowledge the receipt.</td></tr><tr><td></td></tr><tr><td>Regards,</td></tr><tr><td><tr><td>VAR Administrator</td></tr><tr><td>044-43915114 / 5119</td><tr></table><body></html>";

//Attachment attach = new Attachment(ms, inv_no + ".xls");

//email.Attachments.Add(attach);

// You can specify the host name or ipaddress of your server

// Default in IIS will be localhost

//client.PickupDirectoryLocation = @"C:\Inetpub\mailroot\Pickup\";



//Default port will be 25

mailClient.Port = 25;

mailClient.DeliveryMethod =
SmtpDeliveryMethod.SpecifiedPickupDirectory;

mailClient.PickupDirectoryLocation = @"C:\Inetpub\mailroot\Pickup\";

mailClient.Send(email);
}

No comments:

Post a Comment