Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Urgent issue with DotNetNuke.Services.Mail.Mail.SendMailUrgent issue with DotNetNuke.Services.Mail.Mail.SendMail
Previous
 
Next
New Post
8/23/2011 11:44 AM
 
I have an urgent issue with a live site we upgraded to 6.0 about 8 days ago. Specifically, we have the following line of code that was working on 5.6.

Line 77:             Dim strFrom As String = PortalSettings.Current.Email
Line 78:             DotNetNuke.Services.Mail.Mail.SendMail(strFrom, eMail, bcceMail, subject, message, Nothing, "html", Nothing, Nothing, Nothing, Nothing)

The failure is the second line:

Object reference not set to an instance of an object.

The code is unchanged from before the upgrade (and has been running fine for a couple of years). Have there been some changes with DotNetNuke.Services.Mail.Mail.SendMail in 6.0?

Thanks.

Mark

 
New Post
8/23/2011 2:27 PM
 
Hi Mark

Can you provide more information - a full Stack Trace for example.

It is possible that there was a change inside the core method that expects a non-null object to passed for one of the parameters which you passed in as "Nothing".

Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
8/23/2011 2:32 PM
 
Thank you Charles. Here you go...

NullReferenceException: Object reference not set to an instance of an object.]
   DotNetNuke.Services.Mail.Mail.SendMail(String MailFrom, String MailTo, String Cc, String Bcc, MailPriority Priority, String Subject, MailFormat BodyFormat, Encoding BodyEncoding, String Body, String Attachment, String SMTPServer, String SMTPAuthentication, String SMTPUsername, String SMTPPassword, Boolean SMTPEnableSSL) +118
   DotNetNuke.Services.Mail.Mail.SendMail(String MailFrom, String MailTo, String Cc, String Bcc, MailPriority Priority, String Subject, MailFormat BodyFormat, Encoding BodyEncoding, String Body, String Attachment, String SMTPServer, String SMTPAuthentication, String SMTPUsername, String SMTPPassword) +225
   DotNetNuke.Services.Mail.Mail.SendMail(String MailFrom, String MailTo, String Bcc, String Subject, String Body, String Attachment, String BodyType, String SMTPServer, String SMTPAuthentication, String SMTPUsername, String SMTPPassword) +365
   <Page Here>
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +114
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +139
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +28
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2980
 
New Post
8/23/2011 4:19 PM
 
Charles Nurse wrote:
Hi Mark

Can you provide more information - a full Stack Trace for example.

It is possible that there was a change inside the core method that expects a non-null object to passed for one of the parameters which you passed in as "Nothing".

 Thanks again, Colin. Your comment got me thinking. I changed each of the Nothing parameters to an empty string ("") and was able to run this code. That's a very good thing - since this was on our live site - so much appreciated.

What worries me is how I would find out about this proactively. Searching the DNN site, forums, Bing, etc I can't locate any information about such a change. I'd be interested to know if anyone is aware of a change log for APIs such as this which would have allowed me to discover this procactively.

Thanks again.

Mark

 
New Post
8/24/2011 12:17 AM
 
Mark, if a parameter is expecting a string, you should pass an empty string, if possible. Nothing indicates, you are not passing an object, which is not supported in this case.
btw, I agree, that there is some room for improvement for the send mail interface, usually, you should have no doubt about smtp settings.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Urgent issue with DotNetNuke.Services.Mail.Mail.SendMailUrgent issue with DotNetNuke.Services.Mail.Mail.SendMail


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out