non useful log about wrong e-mail address format

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
11/24/2009 5:08:40 PM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

non useful log about wrong e-mail address format

When user posts comment at my contact us page I get the following log (I can see the post ok at the site's "see messages" frame when logged in as admin, but never receive them by e-mail)

 

The error message isn't useful, since it doesn't tell me which exact string has the problem (it has to do with SMTP settings in my user.config obviously)

 

--- 

<add key="DisableDotNetOpenMail" value="false" /> <!-- also tried with this set to true -->

<add key="SMTPServer" value="..." />

<add key="SMTPRequiresAuthentication" value="true" />

<add key="SMTPUseSsl" value="false" />

<add key="SMTPPort" value="25" />

<add key="SMTPUser" value="..." /> <!-- tried both user and user@server here -->

<add key="SMTPPassword" value="..." />

<add key="SMTPTimeoutInMilliseconds" value="30000" />

<!-- leave this blank for ascii encoding -->

<add key="SmtpPreferredEncoding" value="utf-8" />

 

*** could it be the "utf-8" smtp encoding setting the problem there? (user.config file is saved in utf-8 format, checked just in case)

---------

2009-11-25 00:34:01,989 ERROR mojoPortal.Web.ContactUI.ContactForm - System.FormatException: The specified string is not in the form required for an e-mail address.

at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName)

at System.Net.Mail.MailAddress.ParseValue(String address)

at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)

at System.Net.Mail.MailAddress..ctor(String address)

at mojoPortal.Net.Email.SendEmailNormal(SmtpSettings smtpSettings, String from, String replyTo, String to, String cc, String bcc, String subject, String messageBody, Boolean html, String priority, String[] attachmentPaths, String[] attachmentNames)

at mojoPortal.Net.Email.SendEmailNormal(SmtpSettings smtpSettings, String from, String replyTo, String to, String cc, String bcc, String subject, String messageBody, Boolean html, String priority)

at mojoPortal.Net.Email.SendEmail(SmtpSettings smtpSettings, String from, String replyTo, String to, String cc, String bcc, String subject, String messageBody, Boolean html, String priority)

at mojoPortal.Web.ContactUI.ContactForm.btnSend_Click(Object sender, EventArgs e)

2009-11-25 00:35:17,902 INFO mojoPortal.Web.Global - Global.asax.cs Application_End

2009-11-25 00:35:29,225 INFO mojoPortal.Web.Global - Application Started.

 



11/28/2009 5:45:55 AM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

Can anyone help with this one? I've tried everything (even enabling per site settings so that my form uses settings specified by the site admin and not in web.config)

In user.config I now have the following:

<add key="EnableSiteSettingsSmtpSettings" value="true" />

<add key="MaskSmtpPasswordInSiteSettings" value="true" />

<add key="ShowSmtpEncodingOption" value="true" />

<add key="DisableDotNetOpenMail" value="false" />

but keeps on saying the same message in the log (the strange thing is that the exception trace seems to be the same irrespective of the DisableDotNetOpenMail setting - is that option working at all?).

...

at mojoPortal.Net.Email.SendEmailNormal(SmtpSettings smtpSettings, String from, String replyTo, String to, String cc, String bcc, String subject, String messageBody, Boolean html, String priority)

at mojoPortal.Net.Email.SendEmail(SmtpSettings smtpSettings, String from, String replyTo, String to, String cc, String bcc, String subject, String messageBody, Boolean html, String priority)

...

11/28/2009 6:16:54 AM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

Hi George,

The problem is that as soon as you set this to true:

<add key="EnableSiteSettingsSmtpSettings" value="true" />

it now ignores the smtp settings from config file and looks for them as site settings which you have not populated.

When you set that to true, a new tab appears in the site settings page for entering the smtp settings.

I also recommend you set DisableDotNetOpenMail back to true and just let it use the System.Net.Mail classes. I may get rid of DotNetOpenMail, it initially offered some promise of features not included in the framework (like multi part messages with both an html and plain text body) but over time it has shown that it has issues of its own. Currently there is no benefit to using it.

Also if RunningInMediumTrust = true in Web.config it will not use DotNetOpenMail either.

Hope it helps,

Joe

11/28/2009 10:46:23 AM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

Thanks for the reply Joe,

but it's not that the problem, I have filled-in the details at the site settings tab ok (I did it on purpose to make the settings easier to maintain and in the process of trying to troubleshoot why I can't send any e-mail from the portal [I never made it to])

we're not in medium trust and have tried with both values of DisableDotNetOpenMail (I'll set it to true again)

I wonder which is the offending e-mail string. Isn't the exception saying which one it is? (else couldn't you add some direct calls to that parsing function that .NET calls at the phase where you load site options the 1st time and also when those settings are updated from the GUI [both for the config files and the site settings tab that is]). That way we'd know what the offending string is exactly (you'd catch that exception and spit it out together with the exception)

11/28/2009 10:50:04 AM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

Have you populated the default email from address in site settings? It should usually use the same email address as the smtp account.

Have you populated the address to send the contact form submission to in the settings of the contact form with a valid email address?

11/28/2009 10:51:11 AM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

Btw, another reason I set it to use per-site settings was so that the contact form wouldn't use the web.config ASP.net mail settings (in case they were the probkem) but the ones I set at the GUI (according to your docs) - in both cases though I see the exact same error trace and same error. Is it correct that the contact form will use the per site settings?

11/28/2009 10:51:40 AM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

I don't think you can use utf8 encoding for email. Change that to an empty string.

11/28/2009 10:55:51 AM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

also using the following at web.config, but it didn't help that I added deliveryMethod="Network" and defaultCredentials="false" (if defaultCredentials is true at machine.config it will ignore userName/password). Trying using a userName with and without @mymailserver... too with no luck

------------------- 

<system.net>

<mailSettings>

<smtp deliveryMethod="Network" from="...@...">

<network defaultCredentials="false" host="..." port="25" password="..." userName="..." />

</smtp>

</mailSettings>

</system.net>

11/28/2009 11:03:01 AM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

my issue is with:

System.FormatException: The specified string is not in the form required for an e-mail address.

at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName)

at System.Net.Mail.MailAddress.ParseValue(String address)

at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)

at System.Net.Mail.MailAddress..ctor(String address)

at mojoPortal.Net.Email.SendEmailNormal(SmtpSettings smtpSettings, String from, String replyTo, String to, String cc, String bcc, String subject, String messageBody, Boolean html, String priority, String[] attachmentPaths, String[] attachmentNames)

...

mojoPortal.Net.Email.SendEmailNormal should wrap calls to System.Net.Mail.MailAddress constructor and throw a better exception message letting me know if it's the From, the replyTo, the To, the cc or bcc string that's the issue and what's exactly the offending value (of course the offending value html encoded or something to avoid code injection attacks by people perusing the contact form to attack the admin when they use the log viewer)

11/28/2009 11:04:03 AM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

Yes, the contact form will use the settings from site settings.

Are you sure about the to and from address being correct? You did not answer.

I just found this so maybe I need to add code to make it use utf-8 if specified. But the error is about the email address not the body encoding.

11/28/2009 11:08:41 AM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

I will add a catch for format exception to show the addresses in the error.

You must sign in to post in the forums. This thread is closed to new posts.