/// <summary> /// E-Mail durch Benutzereingabe /// </summary> /// <param name="model"></param> /// <returns></returns> public EmailResult CustomTextEmail(CustomMailModel model) { if (!string.IsNullOrEmpty(model.SenderUser.Email)) { From = new MailAddress(model.SenderUser.Email, model.SenderUser.FirstName + " " + model.SenderUser.LastName + " (via NINE)").ToString(); } if (model.ReceiverUsers.Count == 1) { To.Add(model.ReceiverUsers.First().Email); } else { // Mehr als einer => BCC foreach (var receiver in model.ReceiverUsers) { BCC.Add(receiver.Email); } } foreach (var attachtment in model.Attachments) { Attachments.Add(attachtment.FileName, attachtment.Bytes); } Subject = model.Subject; return(Email("CustomTextMail", model)); }
public EmailResult SendAnnouncementEmail(Message model, List <string> emailList) { emailList.ForEach(x => To.Add(x)); string earnEmail = "", esrgcEmail = ""; try { earnEmail = ConfigurationManager.AppSettings["earnEmail"].ToString(); esrgcEmail = ConfigurationManager.AppSettings["esrgcEmail"].ToString(); } catch { earnEmail = "*****@*****.**"; esrgcEmail = "*****@*****.**"; } BCC.Add(earnEmail); BCC.Add(esrgcEmail); Subject = "EARN MD CONNECT - " + model.Title; return(Email("SendAnnouncementEmail", model)); }
public EmailResult SendNewsletter(Newsletter newsletter) { var blog = _blogRepository.First(); To.Add(blog.Email); foreach (var subscriber in newsletter.Subscribers) { BCC.Add(subscriber.Email); } From = blog.Email; Subject = newsletter.Title; return(Email("SendNewsletter", new Article { Title = newsletter.Title, ImageUrl = newsletter.ImageUrl, Body = newsletter.Body })); }
/// <summary>Adds a recipient EmailAddress to the MailMessage</summary> /// <param name="address">EmailAddress that you want to add to the MailMessage</param> /// <param name="type">AddressType of the address</param> /// <example> /// <code> /// MailMessage msg = new MailMessage("*****@*****.**", "*****@*****.**"); /// MailAddress cc = new MailAddress("*****@*****.**"); /// msg.AddRecipient(cc, AddressType.Cc); /// </code> /// </example> public void AddRecipient(MailAddress address, AddressType type) { try { switch (type) { case AddressType.To: To.Add(address); break; case AddressType.Cc: CC.Add(address); break; case AddressType.Bcc: BCC.Add(address); break; } } catch (Exception e) { throw new SmtpException(string.Format("Exception in AddRecipient: {0}", e)); } }
public void AddBCC(string email) { BCC.Add(email); }
public void AddBccUser(User bccUser, bool isRead = false) { BCC.Add(bccUser); IsRead[bccUser.Email] = isRead; }