Welcome Guest Search | Active Topics | Log In | Register

Error Sending E-mail - The specified string is not in the form required for an e-mail address Options · View
vash
#1 Posted : Sunday, September 21, 2008 4:09:54 PM

Rank: YAF Commander


Joined: 9/2/2008
Posts: 84
Location: Philippines
Hi,

I'm encountering an error when sending email either by email the topic or loggin in as admin and using the email feature in the admin page.

Here is the error message that I get:






The error is triggered by this code:
Code:
SendMail.Send( PageContext.BoardSettings.ForumEmail, ( string )row ["Email"], Subject.Text.Trim(), Body.Text.Trim() );


I tried to change the code and put some fixed values like the code below but the error is still the same
Code:
SendMail.Send("admin@itchytech.net", "rico@hotmail.com", "Sample", "Sample Only");



Any Idea? Thanks in advance...
test2005
#2 Posted : Sunday, September 21, 2008 7:08:39 PM

Rank: YAF MVP



Joined: 2/12/2005
Posts: 923
Location: Italy
Have you double checked your SMTP settings are correct?
.....the man in black fled across the desert..........and the gunslinger followed.....

vash
#3 Posted : Sunday, September 21, 2008 11:21:29 PM

Rank: YAF Commander


Joined: 9/2/2008
Posts: 84
Location: Philippines
Hi test2005,

Here is the setting of my mail.config file

Code:

<!--
    SMTP setup for sending of e-mails from your forum.
-->
<smtp from="mail.itchytech.net" deliveryMethod="Network">
    <network host="mail.itchytech.net" password="mypassword" userName="admin@itchytech.net" />
</smtp>


Below is the error that appear when I use the email sending in admin section.

Code:

Server Error in '/' Application.
The specified string is not in the form required for an e-mail address.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:

[FormatException: The specified string is not in the form required for an e-mail address.]
   System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName) +934335
   System.Net.Mail.MailAddress.ParseValue(String address) +245
   System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) +87
   System.Net.Mail.MailMessage..ctor() +271
   YAF.Classes.Utils.SendMail.Send(MailAddress fromAddress, MailAddress toAddress, String subject, String bodyText, String bodyHtml) +548
   YAF.Classes.Utils.SendMail.Send(MailAddress fromAddress, MailAddress toAddress, String subject, String bodyText) +39
   YAF.Classes.Utils.SendMail.Send(String fromEmail, String toEmail, String subject, String body) +82
   YAF.Pages.Admin.mail.Send_Click(Object sender, EventArgs e) +354
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433



Here is the error that I get when using the Email this topic feature under the options menu

test2005
#4 Posted : Tuesday, September 23, 2008 8:10:47 AM

Rank: YAF MVP



Joined: 2/12/2005
Posts: 923
Location: Italy
I'd double check with your provider that the SMTP setting your using is correct and that the username has permissions to send.

Have you tried sending to a different e-mail address? One without an undercore ( _ ) ?


.....the man in black fled across the desert..........and the gunslinger followed.....

Jaben
#5 Posted : Tuesday, September 23, 2008 9:00:10 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 2,963
Location: Honolulu, HI
Code:

<smtp from="mail.itchytech.net" deliveryMethod="Network">
    <network host="mail.itchytech.net" password="mypassword" userName="admin@itchytech.net" />
</smtp>


Your smtp from="" is incorrect... that is the email address that the email is coming from.

Corrected:

Code:

<smtp from="admin@itchytech.net" deliveryMethod="Network">
    <network host="mail.itchytech.net" password="mypassword" userName="admin@itchytech.net" />
</smtp>
"When you are grateful, fear disappears and abundance appears”."

vash
#6 Posted : Wednesday, September 24, 2008 3:00:52 PM

Rank: YAF Commander


Joined: 9/2/2008
Posts: 84
Location: Philippines
Hi Guys...

Thanks for the replies... I've already made necessary corrections to the mail.config and email are now working. Just a suggestion is to make the error message more intuitively related to the error in the mail.config settings...


Thanks again....
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.083 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET