Copied to clipboard

Flag this post as spam?

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


  • Lewis Smith 208 posts 617 karma points c-trib
    Mar 13, 2018 @ 12:06
    Lewis Smith
    0

    Updating task that sends emails to use my own service

    Hi,

    I'm currently in dev with tea commerce and I'm running into a few issues...

    Firstly on success, success emails aren't sending giving me this error

        Error sending Confirmation email template. Order id: c234ac35-cb2e449b-bb94-dc501b53f68f. Cart number: CART-29 System.Net.Mail.SmtpException: The operation has timed out.
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       at TeaCommerce.Api.Models.EmailTemplate.Send[T](T model, String customerEmail, Nullable`1 languageId)
    

    I believe this is down to the credentials that I have input being incorrect, but at my company, we have our own email sending service which I need to implement into tea commerce.

    Is there any way I can update the send email task so I can use my own service instead of the default one?

    Thanks, Lewis

  • Brian Lyk Larsen 19 posts 274 karma points
    Mar 14, 2018 @ 09:07
    Brian Lyk Larsen
    1

    Hi Lewis,

    You can canel the email sent by Tea Commerce, and use your own email sending service instead, by subscribing to the MailSending event.

    You can subscribe to events using the Notification Center: Tea Commerce docs

    Something like this would probably do the trick:

    using TeaCommerce.Api.Models;
    using TeaCommerce.Api.Notifications;
    using Umbraco.Core;
    
    namespace Website.Events {
      public class TeaCommerceEventHandler : ApplicationEventHandler {
    
        public TeaCommerceEventHandler() {
          NotificationCenter.EmailTemplate.MailSending += EmailTemplate_MailSending;
        }
    
        private void EmailTemplate_MailSending( EmailTemplate emailTemplate, MailSendingEventArgs e ) {
          if ( emailTemplate.Alias == "confirmation" ) {
            e.Cancel = true; //Cancel the mail sent by Tea Commerce
    
            MyOwnEmailSendingService.Instance.SendConfirmation( e.Order );
          }
        }
      }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft