Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using Blat or MailMessage()
Message
De
05/09/2011 08:21:57
 
 
À
02/09/2011 12:17:50
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01522297
Message ID:
01522719
Vues:
26
Thanks Bill,

I was wondering if it was just a wrapper around the MailMessage and SMTPClient stuff.

>Frank
>
>Sorry about that!
>When you get to my age, you forget these things
>I had put a class elsewhere in the code and forgot about it!
>Here's the class
>
>
>
>
>public class SMTPMailer
>{
>  public string SendMailMessasge(string MailSendToAddress, string MailSendFrom,
>      string MailSubject, string MailSMTPServer, string MailSMTPUser, string MailSMTPPassword, string MailCC, string MailBody)
>  {
>
>    string returnmessage = "Mail Sent";   
>    System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
>    message.To.Add(MailSendToAddress);
>    if (!(MailCC.TrimEnd() == ""))
>      message.CC.Add(MailCC);
>    message.Subject = MailSubject;
>    message.From = new System.Net.Mail.MailAddress(MailSendFrom);
>    message.Body = MailBody;
>    try
>    {
>    System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(MailSMTPServer, 25);
>    smtp.Credentials = new NetworkCredential(MailSMTPUser, MailSMTPPassword);
>    smtp.Send(message);
>    }
>    catch (Exception ex)
>    {
>     returnmessage = ex.Message;
>    }
>   return returnmessage; 
>  } // end  SendMailMessage
>} // end class SMTP mailer
>
>
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform