public Email( EmailAccount from, List <EmailContact> tos, string subject, string message, bool isHtml, string batchId, DateTime initialSendDate, bool isSigned, bool isEncrypted ) { From = from; To.AddRange(tos); Subject = subject; Message = message; IsHtml = isHtml; BatchId = batchId; SendDate = initialSendDate; IsSigned = isSigned; IsEncrypted = isEncrypted; Guid = System.Guid.NewGuid().ToString(); DateCreated = DateTime.Now; DateLastEdited = DateTime.Now; SendingStatus = EmailSendStatus.PENDING; }
public CustomMessage(IEnumerable <string> to, string subject, string content, IFormFileCollection attachments) { To.AddRange(to.Select(adressInString => new MailboxAddress(adressInString))); Subject = subject; Content = content; Attachments = attachments; }
public Email(int id, string guid, EmailAccount from, List <EmailContact> tos, string subject, string message, bool isHtml, string batchId, DateTime initialSendDate, bool isSigned, bool isEncrypted, EmailSendStatus sendingStatus, DateTime dateCreated, string createdBy, DateTime dateLastEdited, string lastEditedBy) { Id = id; Guid = guid; From = from; To.AddRange(tos); Subject = subject; Message = message; IsHtml = isHtml; BatchId = batchId; SendDate = initialSendDate; IsSigned = isSigned; IsEncrypted = isEncrypted; SendingStatus = sendingStatus; DateCreated = dateCreated; CreatedBy = createdBy; DateLastEdited = dateLastEdited; LastEditedBy = lastEditedBy; }
public EmailMessage(string @from, IEnumerable <string> toList, string subject, string body) { From = from; To.AddRange(toList); Subject = subject; Body = body; }
public Message(IEnumerable <string> to, string subject, string content) { this.Subject = subject; this.Content = content; this.To = new List <MailboxAddress>(); To.AddRange(to.Select(x => new MailboxAddress(x.Trim()))); }
public Message(IEnumerable <string> to, string subject, string content, IFormFileCollection attachments) { To.AddRange(to.Select(x => MailboxAddress.Parse(x))); Subject = subject; Content = content; Attachments = attachments; }
public MailMessageSimple(string from, IEnumerable <string> to, string subject, string content) { From = from; Subject = subject; Content = content; To.AddRange(to); }
public Message(IEnumerable <string> to, string subject, string content, IList <IFormFile> attachments) { To.AddRange(to.Select(email => new MailboxAddress(email))); Subject = subject; Content = content; if (attachments != null) { Attachments = attachments; } }
public MailMessage(string to, string subject, string body, string from) { Guard.NotEmpty(to, nameof(to)); Guard.NotEmpty(subject, nameof(subject)); Guard.NotEmpty(body, nameof(body)); Guard.NotEmpty(from, nameof(from)); To.AddRange(TokenizeAddressParameter(to)); Subject = subject; Body = body; From = new MailAddress(from); }
private void AddToProperty() { To = AddUIComponent <MarkupLineSelectPropertyPanel>(); To.Text = NodeMarkup.Localize.LineEditor_To; To.Position = RulePosition.End; To.Init(); To.AddRange(Editor.SupportPoints); To.SelectedObject = Rule.To; To.OnSelectChanged += ToChanged; To.OnSelect += (panel) => Editor.SelectRuleEdge(panel); To.OnHover += Editor.HoverRuleEdge; To.OnLeave += Editor.LeaveRuleEdge; }
/// <summary> /// Initializes a new instance of the <see cref="EmailMessage"/> class. /// </summary> /// <param name="to">To.</param> /// <param name="message">The message.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> public EmailMessage(IEnumerable <string> to, string message, bool isHtml) : this() { To.AddRange(to); if (isHtml) { Html = message; } else { Text = message; } }
public Message(IEnumerable <string> to, string subject, string content, dynamic model, IFormFileCollection?attachments, bool isRazorTemplate = true) { To = new(); IsRazorTemplate = isRazorTemplate; Model = model; To.AddRange(to.Select(x => x)); Subject = subject; Content = content; Attachments = attachments; }
internal EmailNotifyService( bool enabled, string from, string fromName, IEnumerable <string> to, string subject, string smtp, int port, ILoginHandler loginHandler ) { if (to == null) { throw new ArgumentNullException(nameof(to)); } Enabled = enabled; From = from ?? throw new ArgumentNullException(nameof(from)); FromName = fromName ?? throw new ArgumentNullException(nameof(fromName)); To.AddRange(to); Subject = subject ?? throw new ArgumentNullException(nameof(subject)); Smtp = smtp ?? throw new ArgumentNullException(nameof(Smtp)); Port = port; LoginHandler = loginHandler ?? throw new ArgumentNullException(nameof(loginHandler)); }
public void AddTo(ICollection <string> to) { to = to ?? new List <string>(); To.AddRange(to); }
/// <summary> /// Parses a single header and sets member variables according to it. /// </summary> /// <param name="headerName">The name of the header</param> /// <param name="headerValue">The value of the header in unfolded state (only one line)</param> /// <exception cref="ArgumentNullException">If <paramref name="headerName"/> or <paramref name="headerValue"/> is <see langword="null"/></exception> private void ParseHeader(string headerName, string headerValue) { if (headerName == null) { throw new ArgumentNullException("headerName"); } if (headerValue == null) { throw new ArgumentNullException("headerValue"); } switch (headerName.ToUpperInvariant()) { // See http://tools.ietf.org/html/rfc5322#section-3.6.3 case "TO": To.AddRange(RfcMailAddress.ParseMailAddresses(headerValue)); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.3 case "CC": Cc.AddRange(RfcMailAddress.ParseMailAddresses(headerValue)); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.3 case "BCC": Bcc.AddRange(RfcMailAddress.ParseMailAddresses(headerValue)); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.2 case "FROM": // There is only one MailAddress in the from field From = RfcMailAddress.ParseMailAddress(headerValue); break; // http://tools.ietf.org/html/rfc5322#section-3.6.2 // The implementation here might be wrong case "REPLY-TO": // This field may actually be a list of addresses, but no // such case has been encountered ReplyTo = RfcMailAddress.ParseMailAddress(headerValue); break; // http://tools.ietf.org/html/rfc5322#section-3.6.2 case "SENDER": Sender = RfcMailAddress.ParseMailAddress(headerValue); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.5 // RFC 5322: // The "Keywords:" field contains a comma-separated list of one or more // words or quoted-strings. // The field are intended to have only human-readable content // with information about the message case "KEYWORDS": string[] keywordsTemp = headerValue.Split(','); foreach (string keyword in keywordsTemp) { // Remove the quotes if there is any Keywords.Add(Utility.RemoveQuotesIfAny(keyword.Trim())); } break; // See http://tools.ietf.org/html/rfc5322#section-3.6.7 case "RECEIVED": // Simply add the value to the list Received.Add(new Received(headerValue.Trim())); break; case "IMPORTANCE": Importance = HeaderFieldParser.ParseImportance(headerValue.Trim()); break; // See http://tools.ietf.org/html/rfc3798#section-2.1 case "DISPOSITION-NOTIFICATION-TO": DispositionNotificationTo = RfcMailAddress.ParseMailAddresses(headerValue); break; case "MIME-VERSION": MimeVersion = headerValue.Trim(); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.5 case "SUBJECT": Subject = EncodedWord.Decode(headerValue); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.7 case "RETURN-PATH": // Return-paths does not include a username, but we // may still use the address parser ReturnPath = RfcMailAddress.ParseMailAddress(headerValue); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.4 // Example Message-ID // <*****@*****.**> case "MESSAGE-ID": MessageId = HeaderFieldParser.ParseId(headerValue); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.4 case "IN-REPLY-TO": InReplyTo = HeaderFieldParser.ParseMultipleIDs(headerValue); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.4 case "REFERENCES": References = HeaderFieldParser.ParseMultipleIDs(headerValue); break; // See http://tools.ietf.org/html/rfc5322#section-3.6.1)) case "DATE": Date = headerValue.Trim(); DateSent = Rfc2822DateTime.StringToDate(headerValue); break; // See http://tools.ietf.org/html/rfc2045#section-6 // See ContentTransferEncoding class for more details case "CONTENT-TRANSFER-ENCODING": ContentTransferEncoding = HeaderFieldParser.ParseContentTransferEncoding(headerValue.Trim()); break; // See http://tools.ietf.org/html/rfc2045#section-8 case "CONTENT-DESCRIPTION": // Human description of for example a file. Can be encoded ContentDescription = EncodedWord.Decode(headerValue.Trim()); break; // See http://tools.ietf.org/html/rfc2045#section-5.1 // Example: Content-type: text/plain; charset="us-ascii" case "CONTENT-TYPE": ContentType = HeaderFieldParser.ParseContentType(headerValue); break; // See http://tools.ietf.org/html/rfc2183 case "CONTENT-DISPOSITION": ContentDisposition = HeaderFieldParser.ParseContentDisposition(headerValue); break; // See http://tools.ietf.org/html/rfc2045#section-7 // Example: <foo4*[email protected]> case "CONTENT-ID": ContentId = HeaderFieldParser.ParseId(headerValue); break; default: // This is an unknown header // Custom headers are allowed. That means headers // that are not mentionen in the RFC. // Such headers start with the letter "X" // We do not have any special parsing of such // Add it to unknown headers UnknownHeaders.Add(headerName, headerValue); break; } }
public SendGridMessage(string from, params string[] to) { From = from; To.AddRange(to); }
public EmailMessage(IEnumerable <string> toList, string subject, string body) { To.AddRange(toList); Subject = subject; Body = body; }
public void AddTo(IEnumerable <string> emails) { To.AddRange(emails.Select(email => new MailboxAddress(email, email)).ToList()); }