Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between DotNetNuke.Services.Mail.Mail.SendEmail and DotNetNuke.Services.Mail.Mail.SendMail

I want to send an email after a registration process in a DNN module. When i searched i found that there is an in-built mail class in dnn. But it contains two methods - SendEmail and SendMail. What is the difference between these two?And which one i have to opt in this case.

like image 904
Mahesh KP Avatar asked Apr 22 '11 05:04

Mahesh KP


2 Answers

SendEmail was introduced in DNN 5.3, and greatly simplifies the API. If you're able to use the SendEmail method, I would recommend it, it's much simpler than SendMail (which always requires SMTP information, even though it's almost always pulled from settings).

If you're looking for

  • from
  • to
  • subject
  • body

with optional

  • sender
  • attachments

then SendEmail is what you want.

like image 63
bdukes Avatar answered Sep 30 '22 04:09

bdukes


To expand on bdukes answer...

SendEmail() is great for sending basic emails.

SendMail() is great for sending emails where you need to access additional options. Things like CC addresses, BCC addresses, and Body Style can be set using this function. The function call looks a lot more complicated, but other than a few additional parameters, there is nothing difficult about using SendMail(), so don't be discouraged if it takes an extra minute to set up the function call.

When using SendMail() if blank strings are used for the SMTP parameters, the function will use the DNN SMTP settings.

Here is a short article by Chris Hammond that shows how simple using SendMail() is, http://weblogs.asp.net/christoc/archive/2006/06/23/DotNetNuke-Daily-Tip-6_2D00_23_2D00_06.aspx

like image 22
RacerNerd Avatar answered Sep 30 '22 04:09

RacerNerd