vash
  • Posts: 61
  • Joined: 01/09/2008
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:

UserPostedImage




The error is triggered by this 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
SendMail.Send("admin@itchytech.net", "rico@hotmail.com", "Sample", "Sample Only");



Any Idea? Thanks in advance...
Sponsor
test2005
  • Posts: 761
  • Joined: 12/02/2005
Have you double checked your SMTP settings are correct?

.....the man in black fled across the desert..........and the gunslinger followed.....
vash
  • Posts: 61
  • Joined: 01/09/2008
Hi test2005,

Here is the setting of my mail.config file


<!--
	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.


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

UserPostedImage
test2005
  • Posts: 761
  • Joined: 12/02/2005
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
  • Posts: 2544
  • Joined: 09/10/2004

<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:


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

vash
  • Posts: 61
  • Joined: 01/09/2008
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
    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.

    About Us

    The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

    Powered by Resharper Donate with PayPal button

    Project Twitter Updates

    Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved