YAFLogo

Posted by: vash - Sunday, 21 September 2008 07:09:54
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: [IMG]http://i262.photobucket.com/albums/ii119/TrigunMike/emailerror.jpg[/IMG] The error is triggered by this code: [code]SendMail.Send( PageContext.BoardSettings.ForumEmail, ( string )row ["Email"], Subject.Text.Trim(), Body.Text.Trim() );[/code] 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");[/code] Any Idea? Thanks in advance...

Posted by: test2005 - Sunday, 21 September 2008 10:08:39
Have you double checked your SMTP settings are correct?

Posted by: vash - Sunday, 21 September 2008 14:21:29
Hi test2005, Here is the setting of my mail.config file [code] [/code] 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: 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 [/code] Here is the error that I get when using the Email this topic feature under the options menu [IMG]http://i262.photobucket.com/albums/ii119/TrigunMike/emailerror2.jpg[/IMG]

Posted by: test2005 - Monday, 22 September 2008 23:10:47
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 ( _ ) ?

Posted by: Jaben - Tuesday, 23 September 2008 00:00:10
[code] [/code] Your smtp from="" is incorrect... that is the email address that the email is coming from. Corrected: [code] [/code]

Posted by: vash - Wednesday, 24 September 2008 06:00:52
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....