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.

  • Simon Osborne 108 posts 150 karma points
    Nov 10, 2011 @ 17:27
    Simon Osborne
    0

    Email sending from the Admin Tools

    Need to send an email on the Saved event of a custome Admin tab.

    I am having problems with the EmailProfile Entity. If I set to :

            Dim emlServ As New EmailService
            Dim addr As New System.Net.Mail.MailAddress(ord.GetBillingAddress.EmailAddress)

            emlServ.Send(SiteContext.Current.CatalogContext.CurrentCatalogSet.EmailProfile, "OrderShipped", addr, ord.OrderGuid.ToString)

     

    I get the following error:

     

    Server Error in '/' Application.

    No product catalog group supporting the url "http://www.#########.com:80/umbraco/ucommerce/orders/editorder.aspx?id=232" found.

    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.InvalidOperationException: No product catalog group supporting the url "http://www.########.com:80/umbraco/ucommerce/orders/editorder.aspx?id=232" found

     

    I assume it cannot get the current catalogue from the Admin area url. So I tried this:

            ordServ.ChangeOrderStatus(ord, stat, HttpContext.Current.Request.LogonUserIdentity.Name)

            Dim emlServ As New EmailService
            Dim addr As New System.Net.Mail.MailAddress(ord.GetBillingAddress.EmailAddress)
            Dim emlProfile As EmailProfile = EmailProfile.SingleOrDefault(Function(x) x.Name = "Default")

            emlServ.Send(emlProfile, "OrderShipped", addr, ord.OrderGuid.ToString)

     

    But that cause the following error (where "Default" is the only profile name):

     

    Server Error in '/' Application.

    VBStringComparisonExpression

    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.NotSupportedException: VBStringComparisonExpression

     

     

    Any suggestions please?

     

     

     

  • Simon Osborne 108 posts 150 karma points
    Nov 11, 2011 @ 11:17
    Simon Osborne
    0

    Have now changed it to:

            Dim emlServ As New EmailService
            Dim addr As New System.Net.Mail.MailAddress(ord.GetBillingAddress.EmailAddress)
            Dim emlProfile As EmailProfile = EmailProfile.All.ToList(0)

            emlServ.Send(emlProfile, "OrderShipped", addr, ord.OrderGuid.ToString)

    But now I get a 404 error. The "OrderShipped" is an email type name, and I've checked that the email profile now brings back my "Default" profile - how do I get this working!

    Suggestions please, I keep thinking this should be so simple.

  • Simon Osborne 108 posts 150 karma points
    Nov 11, 2011 @ 11:37
    Simon Osborne
    0

    Think the 404 may be because the email is under a tab with a defined hostname different from the Admin tools. If the non-absolute path is used (so the page url is called from the Admin tools domain) it will generate a 404.

    Any thoughts?

    There is an overload method where you submit a generic dictionary of string, string called template parameters but I dont know what ky values are permissable.

  • Simon Osborne 108 posts 150 karma points
    Nov 11, 2011 @ 12:50
    Simon Osborne
    0

    The issue is the hostname. If I access the Admin tools using the same domain as the shop and try it it works, so the reference to the emailtemplate must be relative and not take account of the parent hostname.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 14, 2011 @ 10:11
    Søren Spelling Lund
    0

    I tried reproducing the issue you're describing. Umbraco generates a nice URL for the configure content node and uses the current URL as base URI for the generated URL.

    Can you see the URL being requested in the umbracoLog table? Or by looking at the logs?

    Also are you running with domainPrefix on or off?

    It could also be that you're getting the wrong e-mail profile.

    Try

    EmailProfile.All.Where(Function(x) x.Name = "MyProfile").Single()

    Not a hundred percent on the syntax for lambdas in VB, but it goes along the lines of grabbing a named profile instead of the first one.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 14, 2011 @ 10:14
    Søren Spelling Lund
    0

    BTW you can use the SendEmailTask from the checkout pipeline to send e-mail in the backend without bulding new UI elements to do it. Understanding uCommerce Order Statuses.

     

Please Sign in or register to post replies

Write your reply to:

Draft