예제 #1
0
        }         // constructor

        /// <summary>
        /// With template
        /// </summary>
        public string Send(
            Dictionary <string, string> parameters,
            string to,
            string templateName,
            string subject = "",
            string cc      = "",
            List <attachment> attachments = null
            )
        {
            var toList = PrepareRecipients(to);

            var message = new EmailModel {
                key           = this.key,
                template_name = templateName,
                message       = new EmailMessageModel {
                    to           = toList,
                    subject      = subject,
                    bcc_address  = cc,
                    attachments  = attachments,
                    track_clicks = true,
                    track_opens  = true
                }
            };

            foreach (var var in parameters)
            {
                message.AddGlobalVariable(var.Key, var.Value);
            }

            return(Send(message, SendTemplatePath));
        }         // Send
예제 #2
0
        private EmailModel PrepareEmail(string templateName, string to, Dictionary <string, string> variables, string subject, string cc = "")
        {
            var toList  = PrepareRecipients(to);
            var message = new EmailModel
            {
                key           = _apiKey,
                template_name = templateName,
                message       = new EmailMessageModel
                {
                    to          = toList,
                    subject     = subject,
                    bcc_address = cc
                },
            };

            foreach (var var in variables)
            {
                message.AddGlobalVariable(var.Key, var.Value);
            }

            return(message);
        }
예제 #3
0
        }         // ProcessRequest

        private EmailModel PrepareEmail(string templateName, string to, Dictionary <string, string> variables, string subject, string cc = "", List <attachment> attachments = null)
        {
            var toList = PrepareRecipients(to);

            var message = new EmailModel {
                key           = MandrillKey,
                template_name = templateName,
                message       = new EmailMessageModel {
                    to           = toList,
                    subject      = subject,
                    bcc_address  = cc,
                    attachments  = attachments,
                    track_clicks = true,
                    track_opens  = true,
                },
            };

            foreach (var var in variables)
            {
                message.AddGlobalVariable(var.Key, var.Value);
            }

            return(message);
        }         // PrepareEmail