InvioPro("from@libero.it","to@libero.it","Subject Test SMTP",""<br> Test SMTP Client <br><br> HELLO";");
private void InvioEmailSMTP_SSL(form string, to string, subject string, body string)
{
try{
System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
mail.To = to;
mail.From = form;
mail.Subject = subject ;
mail.Body = body;
mail.BodyFormat = System.Web.Mail.MailFormat.Html;
mail.Priority = System.Web.Mail.MailPriority.High;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtp.libero.it");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 465);
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2);
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1);
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl",true);
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username@libero.it");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password@libero.it");
try
{
System.Web.Mail.SmtpMail.Send(mail);
}
catch (HttpException ehttp)
{
Console.WriteLine("{0}", ehttp.Message);
Console.WriteLine("Here is the full error message output");
Console.Write("{0}", ehttp.ToString());
}
}
catch(System.Exception e)
{
Console.WriteLine("Unknown Exception occurred {0}", e.Message);
Console.WriteLine("Here is the Full Message output");
Console.WriteLine("{0}", e.ToString());
}
//end function
}