about mail?

  • Thread starter Thread starter cfyam
  • Start date Start date
hi
you can use
MailMessage and SmtpMail class to send mails
These are in the System.Web.Mail name space
regards
Ansil
 
using System.Web.Mail;

public static Boolean EnviarMail(string To, string From, string
Subject, string Body, string Servidor)
{
try
{
try
{
MailMessage Message = new MailMessage();
Message.To = To;
Message.From = From;
Message.Subject = Subject;
Message.Body = Body;

try
{
SmtpMail.SmtpServer = Servidor;
SmtpMail.Send(Message);
}
catch(System.Web.HttpException ehttp)
{
//Console.WriteLine("{0}", ehttp.Message);
//Console.WriteLine("Here is the full error message output");
//Console.Write("{0}", ehttp.ToString());
return false;
}
}
catch(IndexOutOfRangeException)
{
return false;
}
}
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());
return false;
}
return true;
}
 
Back
Top