Пример #1
0
        /// <summary>
        /// Create a new e-mail envelop based on the given
        /// e-mail builder data.
        /// </summary>
        /// <param name="MailBuilder">An e-mail builder.</param>
        public EMailEnvelop(AbstractEMailBuilder MailBuilder)
        {
            MailBuilder.EncodeBodyparts();

                              // ToDo: Deep cloning!
            this._MailFrom  = new EMailAddressList(MailBuilder.From);
            this._RcptTo    = new EMailAddressList(MailBuilder.To);
            this._Mail      = new EMail(MailBuilder);
        }
Пример #2
0
 /// <summary>
 /// Create a new e-mail envelop based on the given sender
 /// and receiver addresses and the e-mail builder data.
 /// </summary>
 /// <param name="MailFrom">The sender(s) of the e-mail.</param>
 /// <param name="RcptTo">The receiver(s) of the e-mail.</param>
 /// <param name="EMail">An e-mail.</param>
 /// <param name="RemoteSocket">The remote socket of the incoming SMTP connection.</param>
 public EMailEnvelop(EMailAddressList  MailFrom,
                     EMailAddressList  RcptTo,
                     EMail             EMail,
                     IPSocket          RemoteSocket  = null)
 {
     this._MailFrom      = MailFrom;
     this._RcptTo        = RcptTo;
     this._Mail          = EMail;
     this._RemoteSocket  = RemoteSocket;
 }
Пример #3
0
        /// <summary>
        /// Parse the e-mail from the given e-mail.
        /// </summary>
        /// <param name="EMail">An e-mail.</param>
        /// <param name="MailTextFilter">A filter delegate for filtering e-mail headers.</param>
        public AbstractEMail(EMail EMail,
                             Func <String, Boolean> MailTextFilter = null)
            : this()
        {
            if (EMail.ToText != null)
            {
                this._MailText = EMail.ToText;
                Tools.ParseMail(this._MailText, out _MailHeaders, out _MailBody);
            }

            if (MailTextFilter != null)
            {
                _MailHeaders = new List <KeyValuePair <String, String> >(_MailHeaders.Where(header => MailTextFilter(header.Key.ToLower())));
            }
        }
Пример #4
0
 /// <summary>
 /// Parse the e-mail from the given e-mail.
 /// </summary>
 /// <param name="EMail">An e-mail.</param>
 public MailinglistEMailBuilder(EMail EMail)
     : base(EMail)
 {
 }
Пример #5
0
 /// <summary>
 /// Create a new e-mail envelop based on the given e-mail.
 /// </summary>
 /// <param name="EMail">An e-mail.</param>
 public EMailEnvelop(EMail EMail)
 {
     this._MailFrom = new EMailAddressList(EMail.From);
     this._RcptTo   = new EMailAddressList(EMail.To);
     this._Mail     = EMail;
 }
Пример #6
0
 public Task<MailSentStatus> Send(EMail    EMail,
                                  Byte     NumberOfRetries  = 3,
                                  Boolean  AutoStart        = true)
 {
     return Send(new EMailEnvelop(EMail), NumberOfRetries);
 }
Пример #7
0
 /// <summary>
 /// Parse the e-mail from the given e-mail.
 /// </summary>
 /// <param name="EMail">An e-mail.</param>
 public MailinglistEMailBuilder(EMail EMail)
     : base(EMail)
 {
 }
Пример #8
0
 public static Task <MailSentStatus> SendVia(this EMail EMail,
                                             SMTPClient SMTPClient,
                                             Byte NumberOfRetries = 3)
 {
     return(SMTPClient.Send(EMail, NumberOfRetries));
 }
Пример #9
0
 /// <summary>
 /// Create a new e-mail envelop based on the given sender
 /// and receiver addresses and the e-mail builder data.
 /// </summary>
 /// <param name="MailFrom">The sender(s) of the e-mail.</param>
 /// <param name="RcptTo">The receiver(s) of the e-mail.</param>
 /// <param name="MailBuilder">An e-mail builder.</param>
 /// <param name="RemoteSocket">The remote socket of the incoming SMTP connection.</param>
 public EMailEnvelop(EMailAddressList      MailFrom,
                     EMailAddressList      RcptTo,
                     AbstractEMailBuilder  MailBuilder,
                     IPSocket              RemoteSocket  = null)
 {
     this._RemoteSocket  = RemoteSocket;
     this._MailFrom      = MailFrom;
     this._RcptTo        = RcptTo;
     this._Mail          = new EMail(MailBuilder);
 }
Пример #10
0
 /// <summary>
 /// Create a new e-mail envelop based on the given e-mail.
 /// </summary>
 /// <param name="EMail">An e-mail.</param>
 public EMailEnvelop(EMail EMail)
 {
     this._MailFrom  = new EMailAddressList(EMail.From);
     this._RcptTo    = new EMailAddressList(EMail.To);
     this._Mail      = EMail;
 }
Пример #11
0
 /// <summary>
 /// Parse the e-mail from the given e-mail.
 /// </summary>
 /// <param name="EMail">An e-mail.</param>
 public AbstractEMailBuilder(EMail EMail)
     : base(EMail)
 {
     this._Body = new EMailBodypart(EMail.ToText);
 }
Пример #12
-1
        private MessageId GenerateMessageId(EMail Mail, String DomainPart = null)
        {
            if (DomainPart.IsNullOrEmpty())
                DomainPart = base.RemoteHost;

            var RandomBytes  = new Byte[16];
            _Random.NextBytes(RandomBytes);

            var HashedBytes = _SHAHasher.ComputeHash(RandomBytes.
                                                     Concat(Mail.From.   ToString().ToUTF8Bytes()).
                                                     Concat(Mail.Subject.           ToUTF8Bytes()).
                                                     Concat(Mail.Date.   ToString().ToUTF8Bytes()).
                                                     ToArray());

            return MessageId.Parse(HashedBytes.ToHexString().Substring(0, 24) + "@" + DomainPart);
        }