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

为君一笑 提交于 2020-01-02 02:41:12

问题


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.


回答1:


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.




回答2:


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




回答3:


I think the SendMail internally refers the SendEmail option to send mail.Check their parameters for more details and use the one that is appropriate for your situation.

DotNetNuke.Services.Mail.Mail.SendEmail(String fromAddress, String senderAddress, String toAddress, String subject, String body)
DotNetNuke.Services.Mail.Mail.SendMail(UserInfo user, MessageType msgType, PortalSettings settings)

Thanks!



来源:https://stackoverflow.com/questions/5752548/difference-between-dotnetnuke-services-mail-mail-sendemail-and-dotnetnuke-servic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!