DotNetNuke Daily Tip #2 Mail.SendMail

DotNetNuke Daily Tip #2 Mail.SendMail

check out all of the DotNetNuke Daily Tips from Chris Hammond.

DotNetNuke Daily Tip for 6/23/2006

Have you ever needed to send mail from one of your DotNetNuke modules? Here's the DotNetNuke method for sending off a message.

public static System.String SendMail ( System.String MailFrom , System.String MailTo , System.String Cc , System.String Bcc , DotNetNuke.Services.Mail.MailPriority Priority , System.String Subject , DotNetNuke.Services.Mail.MailFormat BodyFormat , System.Text.Encoding BodyEncoding , System.String Body , System.String Attachment , System.String SMTPServer , System.String SMTPAuthentication , System.String SMTPUsername , System.String SMTPPassword )

But what does that really mean? Here's a simple call to the mail function from a module.

Mail.SendMail("[email protected]", "[email protected]", "", "THIS IS THE SUBJECT", "THIS IS THE MESSAGE BODY", "", "HTML", "", "", "", "" );

Could it get any simpler than that?

Actually it could! Here's another signature for sendmail

public static System.String SendMail ( System.String MailFrom , System.String MailTo , System.String Bcc , System.String Subject , System.String Body , System.String Attachment , System.String BodyType , System.String SMTPServer , System.String SMTPAuthentication , System.String SMTPUsername , System.String SMTPPassword )

 

Do you have a question about DotNetNuke? Perhaps I can answer it here as a Daily DotNetNuke Tip! Email chris.hammond at dotnetnuke.com  with your question! Be sure to put Daily Tips in the subject line.

Recent Comments

Comment Avatar
sendmail is throwing exception "object reference not set to an instance of an object"
Posted By: akbar ali on Feb 2011

Add Comment

Please add your comment by filling out the field(s) below. Your comment may need to be approved before it becomes visible.
Enter your first name for display with the comment
Enter your last name for display with the comment.
Enter your comment here.
If you can't type DNNRocks in, you can't post, plain and simple.
Submit Comment Cancel

Chris Hammond

Chris Hammond is a father, husband, leader, software developer, photographer and car guy. Chris focuses on the latest in technology including artificial intelligence (AI) and has spent decades becoming an expert in ASP.NET and DotNetNuke (DNN) development. You will find a variety of posts relating to those topics here on the website. For more information check out the about Chris Hammond page.

Find me on Twitter, GitHub and LinkedIn.