Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Blat or MailMessage()
Message
From
02/09/2011 12:17:50
 
 
To
02/09/2011 11:13:21
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01522297
Message ID:
01522596
Views:
27
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
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform