Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Ivan Saric 40 posts 89 karma points
    Sep 03, 2014 @ 17:22
    Ivan Saric
    0

    Cannot send an email

    Hi, I followed next article http://www.publicvoid.dk/SendingEmailUsingUCommerce.aspx for sending email using uCommerce. I received an error "The specified string is not in the form required for an e-mail address." I checked toAddres parameter and it's fine email address. Is there any other settings or configuration for email service that I need to set?

    For SMTP I'm using gmail like this:

    <mailSettings>
            <smtp from="[email protected]" deliveryMethod="Network">
                <network 
                    defaultCredentials="false" 
                    host="smtp.gmail.com" 
                    port="587" 
                    password="stR0ngPassW0rd" 
                    userName="[email protected]"
    

    enableSsl="true" />

    My code is next:

    static void Send(string emailType, string toAddress, Dictionary<string, string> parameters){
    // Get the services required for sending e-mails
    var emailService = UCommerce.Infrastructure.ObjectFactory.Instance.Resolve<UCommerce.Transactions.IEmailService>();
    var localizationContext = UCommerce.Infrastructure.ObjectFactory.Instance.Resolve<UCommerce.Infrastructure.Globalization.ILocalizationContext>();
    
    // Find the relevant e-mail profile for the current store
    var emailProfile = UCommerce.Runtime.SiteContext.Current.CatalogContext.CurrentCatalogGroup.EmailProfile;
    
    System.Net.Mail.MailAddress mm = new System.Net.Mail.MailAddress(toAddress);
    // Send e-mail
    emailService.Send(localizationContext,
                        emailProfile,
                        emailType,
                        mm,
                        parameters);
    

    }

  • Morten Skjoldager 440 posts 1499 karma points
    Sep 04, 2014 @ 09:32
    Morten Skjoldager
    0

    Can you send the full stack trace. What version of uCommerce are you running? 

    Best regards

    Morten

  • Ivan Saric 40 posts 89 karma points
    Sep 04, 2014 @ 09:55
    Ivan Saric
    0

    Hi Morten, I'm using Umbraco 6.1.6 with uCommerce 4.0.6.13304 (Demo store version 2.0.0.13249) and full stack trace is:

    2014-09-03 17:14:26,662 [55] WARN umbraco.macro - [Thread 98] Error loading MacroEngine script (file: MyAccountForgottenPassword.cshtml, Type: ''. Exception: System.FormatException: The specified string is not in the form required for an e-mail address.
    System.Net.Mail.MailAddressParser.ReadCfwsAndThrowIfIncomplete(String data, Int32 index) at System.Net.Mail.MailAddressParser.ParseDomain(String data, Int32& index) at System.Net.Mail.MailAddressParser.ParseAddress(String data, Boolean expectMultipleAddresses, Int32& index) at System.Net.Mail.MailAddressParser.ParseAddress(String data) at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) at System.Net.Mail.MailAddress..ctor(String address, String displayName) at UCommerce.Transactions.EmailService.Send(ILocalizationContext localizationContext, EmailProfile profile, String emailTypeName, MailAddress to, IDictionary2 templateParameters) at ASP.uCommerce.Functions.Email.Send(String emailType, String toAddress, Dictionary2 parameters) in d:\Projects\CaffeineOD\trunk\webroot\AppCode\uCommerce\Functions\Email.cshtml:line 12 at ASP.uCommerce.Functions.Email.SendForgottenPasswordEmail(String emailAddress) in d:\Projects\CaffeineOD\trunk\webroot\AppCode\uCommerce\Functions\Email.cshtml:line 39 at ASP.PagemacroScriptsMyAccountForgottenPasswordcshtml.Execute() in d:\Projects\CaffeineOD\trunk\webroot\MacroScripts\MyAccountForgottenPassword.cshtml:line 17 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) at System.Web.WebPages.WebPage.ExecutePageHierarchy()
    at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage) at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage) at umbraco.macro.loadMacroScript(MacroModel macro)
    at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)

  • Jesper Nielsen 141 posts 498 karma points
    Sep 15, 2014 @ 10:53
    Jesper Nielsen
    0

    Hello Ivan,

    Please check the "Sender Name" and "Sender Email" setup for the Email Profile.

    The From address is taken from the profile.

    Kind regards,

    Jesper

Please Sign in or register to post replies

Write your reply to:

Draft