예제 #1
0
        public static string SendEmail(int templateId, List <string> emails, List <string> cc, List <string> bcc, List <Attachment> attachments, Dictionary <string, Object> information = null)
        {
            EmailMessageDistribution messageDistribution = new EmailMessageDistribution()
            {
                Template = new Template {
                    Id = templateId
                },
                To          = new List <IContact>(),
                CC          = new List <IContact>(),
                Bcc         = new List <IContact>(),
                Attachments = attachments
            };

            emails.ForEach(e => messageDistribution.To.Add(new Contact {
                Email = e, Info = information
            }));
            cc.ForEach(c => messageDistribution.CC.Add(new Contact {
                Email = c
            }));
            bcc.ForEach(b => messageDistribution.Bcc.Add(new Contact {
                Email = b
            }));

            return(SendMessage(messageDistribution));
        }
예제 #2
0
        public static string SendEmail(int templateId, List <string> emails, Dictionary <string, Object> information = null)
        {
            EmailMessageDistribution messageDistribution = new EmailMessageDistribution()
            {
                Template = new Template {
                    Id = templateId
                },
                To = new List <IContact>()
            };

            emails.ForEach(e => messageDistribution.To.Add(new Contact {
                Email = e, Info = information
            }));

            return(SendMessage(messageDistribution));
        }
예제 #3
0
        public static string SendEmail(int templateId, string email, Dictionary <string, object> information = null)
        {
            EmailMessageDistribution messageDistribution = new EmailMessageDistribution()
            {
                Template = new Template {
                    Id = templateId
                },
                To = new List <IContact>()
                {
                    new Contact()
                    {
                        Email = email, Info = information
                    }
                }
            };

            return(SendMessage(messageDistribution));
        }
예제 #4
0
        public static string SendEmail(int templateId, string email, string language, Dictionary <string, Object> information = null)
        {
            EmailMessageDistribution messageDistribution = new EmailMessageDistribution()
            {
                Template = new Template {
                    Id = templateId
                },
                To = new List <IContact>()
                {
                    new Contact()
                    {
                        Email = email, Info = information, Language = language != null ? new Language {
                            Culture = language
                        } : null
                    }
                }
            };

            return(SendMessage(messageDistribution));
        }
예제 #5
0
        public static string SendEmailByMailingListId(int templateId, int mailingListId, Dictionary <string, object> information = null)
        {
            Template template = TemplateManager.Get(templateId);

            template.Translations.ForEach(t => t.Parameters = information);

            EmailMessageDistribution messageDistribution = new EmailMessageDistribution()
            {
                Template = template,
                To       = new List <IContact>()
                {
                    new MailingList()
                    {
                        Id = mailingListId
                    }
                }
            };

            return(SendMessage(messageDistribution));
        }