Friday, May 18, 2012 Register  Login

This site uses DNS Made Easy. Use it for reliable and professional DNS services.

RSS Feeds
Categories
  
Blog Archives
  
Blog

Sending license key emails from DotNetNuke

The integration that I had with my ecommerce DNN module (ActivePurchase) broke when I moved the site to PowerDNN. I have been fighting with this for a couple weeks now.

Here's what happened:
The part that sends the serial number did not work anymore, because the SMTP server was not on the same network. Changing the settings did not work at first. I went googling for sending emails from DNN. I got some good hits for sending email from inside DNN modules.

The API for this is fairly simple (relatively). You first make a reference to DotNetNuke.Services.Mail. Then you make a call to the Mail.SendMail() method, with the appropriate parameters. There are 5 overloads. The call from a module would look like this:

DotNetNuke.Services.Mail.Mail.SendMail(FromAddress, SendTo, "", Subject, Body, "", "", "", "", "", "")

Well, that didn't work. So now I was scratching my head.

I am using a special type of integration called a custom step, which is just an assembly in the bin directory for the DotNetNuke install. I had to go and dig into the event log that DNN keeps. There were several exceptions there. The message was that the SMTP connection needed to be authenticated. WTF??

Custom DNN modules use the SMTP settings that the administrator has setup. However, the custom step does not get treated as a module. So I had to do this:

DotNetNuke.Services.Mail.Mail.SendMail(FromAddress, SendTo, "", Subject, Body, "", "", "", "", UserName, Password)

Once I did that, the custom step started sending emails like before. YES!

Now that this is fixed, I can get my undivided attention back to PainlessSVN and SVN Backup Widget stuff.

posted @ Monday, November 24, 2008 10:29 PM by Hector Sosa, Jr

Actions:Tweet This Share on Facebook Share on LinkedIn Emakl Permalink del.icio.us

Previous Page | Next Page

COMMENTS

Thankyou for this post. I was wondering why my custom contact form worked fine everytime when I was logged in, but not when viewing it publicly. Seems that when you are logged in as an admin/host, the SendMail method will work fine.

posted @ Friday, December 12, 2008 6:25 PM by David


Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above:

Terms Of Use | Privacy Statement | SystemWidgets
Copyright 2002-2012 by SystemWidgets
Google Analytics Alternative