Copied to clipboard

Flag this post as spam?

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


  • Dan 1285 posts 3917 karma points c-trib
    Jul 01, 2013 @ 17:53
    Dan
    0

    Tea Commerce order confirmation email to customer AND seller

    Hi,

    I have TeaCommerce set up to send email confirmations to the buyer on completion of their order.  However, the shop administrator would also like to receive order confirmation emails.  How can I set the system up to do this?

    Thanks

  • Anders Burla 2560 posts 8256 karma points
    Jul 01, 2013 @ 22:57
    Anders Burla
    100

    Hi Dan

    Just add the shop owners email as BCC to the email template. Easy as that :)

    Kind regards
    Anders

  • Dan 1285 posts 3917 karma points c-trib
    Jul 02, 2013 @ 00:15
    Dan
    0

    Ah-ha!  I was looking in the settings on the main store node.  Blindingly obvious now I see it on the email template node settings, thanks!

  • Kiel Diller 24 posts 72 karma points
    May 15, 2014 @ 20:35
    Kiel Diller
    0

    Can you explain how you got to the point of sending order confirmation emails? Are they automatically sent upon completion?

  • Anders Burla 2560 posts 8256 karma points
    May 19, 2014 @ 08:35
    Anders Burla
    0

    When an order is finalized (paid for) it will be finalized and the system will send the order confirmation.

    Kind regards
    Anders

  • Kiel Diller 24 posts 72 karma points
    May 19, 2014 @ 14:19
    Kiel Diller
    0

    Sorry, my question came out too early and was uninformed. I finally figured out the emails were being sent in the "Notifications" class and by using the documentation here: notification documentation 

    I was able to grab a hold of the mailsending event and write another function.

    My problem is that the mail provider I'm using requires SSL and to my understanding there is an issue with the SMTP settings in web.config that make using SSL difficult and you must revert back and use System.Web.Mail rather than the new System.Net.Mail and do the following (this is generic example from web)

    What I did was to basically copy the MailMessage object into a new one using the other library so I could add these fields, then send that email in the MailSending function.

    Now, assuming I get this to work. Is there a way to cancel sending the original email? Since the actual SMTP object is not in that function, and you don't actually call the base function to continue functionality. How can I take over and tell the original email not to send because I know it will not anyways? Anyone have a better idea? Or a better workaround the whole SSL issue? I'm using ZOHO mail.

    public static void SendMail()
      {
       string smtpServer = "smtp.domain.com";
       string userName = "johnDoe";
       string password = "pass";
       int cdoBasic = 1;
       int cdoSendUsingPort = 2;
       MailMessage msg = new MailMessage();
       if (userName.Length > 0)
       {
        msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", smtpServer);
        msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25) ;
        msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", cdoSendUsingPort) ;
        msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic);
        msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName);
        msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password); 
       }
       msg.To = "[email protected]";
       msg.From = "[email protected]";
       msg.Subject = "Subject";
       msg.Body = "Message";
       SmtpMail.SmtpServer = smtpServer;
       SmtpMail.Send(msg);
      }

     

     

     

     

  • Anders Burla 2560 posts 8256 karma points
    May 19, 2014 @ 16:28
    Anders Burla
    0

    Just set the mailMessage that is parsed in to null. That should do the trick.

    Kind regards
    Anders

  • Kiel Diller 24 posts 72 karma points
    May 19, 2014 @ 16:34
    Kiel Diller
    0

    I don't think it likes that either...

    Below is error from log. I know that the smtp is still set to 127.... I'm not using that. The email I need is actually sending correctly, I just need the original to stop trying to send.

    2014-05-19 10:32:08,488 [20] INFO  umbraco.BusinessLogic.Log - [Thread 26] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Error | User: 0 | NodeId: -1 | Comment: PayPal(ORDER-4) - Error making API request - error code: 10004

    2014-05-19 10:32:21,800 [20] INFO  umbraco.BusinessLogic.Log - [Thread 21] Redirected log call (please use Umbraco.Core.Logging.LogHelper instead of umbraco.BusinessLogic.Log) | Type: Error | User: 0 | NodeId: -1 | Comment: Error sending email using the email template: Confirmation email email for order edfc9aba-a42d-4051-9b9a-858619abc0d1 - Exception: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25

       at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

       at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

       --- End of inner exception stack trace ---

       at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6)

       at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback)

       at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)

       at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)

       at System.Net.Mail.SmtpClient.Send(MailMessage message)

       --- End of inner exception stack trace ---

       at System.Net.Mail.SmtpClient.Send(MailMessage message)

       at TeaCommerce.Api.Models.EmailTemplate.Send(Order order)

  • Anders Burla 2560 posts 8256 karma points
    May 19, 2014 @ 16:37
    Anders Burla
    0

    The mail sending event and if you set the mailMessage to null should do the trick. Be sure to run latest TC.

  • Kiel Diller 24 posts 72 karma points
    May 19, 2014 @ 16:40
    Kiel Diller
    0

    Here is my exact code...

    I'll look at what version I'm running. Is there an upgrade guide or is it simple just swapping .dll's? I'm so close to launch I don't want to cause myself hours of work if I don't have to. I'll look at revisions and see what is included before I upgrade..

    void EmailTemplate_MailSending(EmailTemplate emailTemplate, Order order, MailMessage mailMessage)

            {

                try

                { 

                    System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();

                    msg.From = mailMessage.From.Address;

                    

                    //Copy mail addresses

                    if (mailMessage.To.Count > 0)

                    {

                        msg.To = mailMessage.To.Select(x => x.Address).Aggregate((a, x) => String.Format("{0}, {1}", a, x));

                    } 

                    if (mailMessage.CC.Count > 0)

                    {

                        msg.Cc = mailMessage.CC.Select(x => x.Address).Aggregate((a, x) => String.Format("{0}, {1}", a, x));

                    }

                    if (mailMessage.Bcc.Count > 0)

                    {

                        msg.Bcc = mailMessage.Bcc.Select(x => x.Address).Aggregate((a, x) => String.Format("{0}, {1}", a, x));

                    }

     

                    msg.Subject = mailMessage.Subject;

                    msg.BodyFormat = System.Web.Mail.MailFormat.Html;

                    msg.Body = mailMessage.Body;

     

                    //Extra fields to allow mail to send

                    msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2; //Send the message using the network (SMTP over the network).

                    msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = ConfigurationManager.AppSettings["SmtpServer"];

                    msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = 465;

                    msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpusessl"] = true; //Use SSL for the connection (True or False)

                    msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"] = 60;

     

                    //If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.

                    msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1; //basic (clear-text) authentication

                    msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = ConfigurationManager.AppSettings["SmtpUsername"];

                    msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = ConfigurationManager.AppSettings["SmtpPassword"];

     

                    System.Web.Mail.SmtpMail.SmtpServer = ConfigurationManager.AppSettings["SmtpServer"];

                    System.Web.Mail.SmtpMail.Send(msg);

                }

                catch (Exception ex)

                {

                    //Not sure what to do here..

                    throw new Exception("Error in email override code:" + ex.Message, ex);

                }

     

                //Kill the original email

                mailMessage = null;

            }

  • Anders Burla 2560 posts 8256 karma points
    May 19, 2014 @ 16:51
    Anders Burla
    0

    See this link for revision history:
    http://documentation.teacommerce.net/revision-history/

    You just download the package version that you want to update to and install as normal Umbraco package.

  • Kiel Diller 24 posts 72 karma points
    May 19, 2014 @ 16:54
    Kiel Diller
    0

    So I just re-install over top of the current install?

    I've made several changes to views. A lot of them are because of the way tax is viewed. It was included in subtotals etc, and I had to undo all of that so it makes sense to me/customer. 

    Obviously I should make a backup, but do you expect it will overwrite all of my changes to emails, views etc? It shows my current version is 2.2.1

  • Anders Burla 2560 posts 8256 karma points
    May 19, 2014 @ 17:28
    Anders Burla
    0

    We dont overwrite views when you just update Tea Commerce. Only the basic ones in TC. The order confirmation emial and edit order template is not overwritten.

Please Sign in or register to post replies

Write your reply to:

Draft