Exemplo n.º 1
0
        /// <summary>
        /// Sends the "ContactUs" message to the store owner
        /// </summary>
        public static CreateMessageResult SendContactUsMessage(this IMessageFactory factory, Customer customer,
                                                               string senderEmail, string senderName, string subject, string message, EmailAddress senderEmailAddress, int languageId = 0)
        {
            var model = new NamedModelPart("Message")
            {
                ["Subject"]     = subject.NullEmpty(),
                ["Message"]     = message.NullEmpty(),
                ["SenderEmail"] = senderEmail.NullEmpty(),
                ["SenderName"]  = senderName.HasValue() ? senderName.NullEmpty() : senderEmail.NullEmpty()
            };

            var messageContext = MessageContext.Create(MessageTemplateNames.SystemContactUs, languageId, customer: customer);

            if (senderEmailAddress != null)
            {
                messageContext.SenderEmailAddress = senderEmailAddress;
            }

            return(factory.CreateMessage(messageContext, true, model));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sends a newsletter subscription deactivation message
 /// </summary>
 public static CreateMessageResult SendNewsLetterSubscriptionDeactivationMessage(this IMessageFactory factory, NewsLetterSubscription subscription, int languageId = 0)
 {
     Guard.NotNull(subscription, nameof(subscription));
     return(factory.CreateMessage(MessageContext.Create(MessageTemplateNames.NewsLetterSubscriptionDeactivation, languageId), true, subscription));
 }