Ejemplo n.º 1
0
        private EMail(IEnumerable <KeyValuePair <String, String> > MailHeader)
        {
            _Header = new List <KeyValuePair <String, String> >(MailHeader);

            foreach (var KVP in _Header)
            {
                switch (KVP.Key.ToLower())
                {
                case "from":       this.From = EMailAddress.Parse(KVP.Value); break;

                case "to":         this.To = EMailAddressList.Parse(KVP.Value); break;

                case "cc":         this.Cc = EMailAddressList.Parse(KVP.Value); break;

                case "bcc":        this.Bcc = EMailAddressList.Parse(KVP.Value); break;

                case "replyto":    this.ReplyTo = EMailAddressList.Parse(KVP.Value); break;

                case "subject":    this.Subject = KVP.Value; break;

                case "date":       this.Date = DateTime.Parse(KVP.Value); break;

                case "message-id": this.MessageId = MessageId.Parse(KVP.Value); break;
                }
            }
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Create a new e-mail based on the given e-mail builder.
        /// </summary>
        /// <param name="MailBuilder">An e-mail builder.</param>
        public EMail(AbstractEMailBuilder MailBuilder)

            : this(MailBuilder.
                   EncodeBodyparts().
                   // Copy only everything which is not related to the e-mail body!
                   MailHeaders.Where(header => !header.Key.ToLower().StartsWith("content")).
                   Concat(MailBuilder.Body.MailHeaders))

        {
            //ToDo: Do a real deep-copy here!
            Body = MailBuilder.Body;

            //ToDo: Work-aroung for PGP/GPG!
            this.From = MailBuilder.From;
            this.To   = MailBuilder.To;
            this.Cc   = MailBuilder.Cc;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Create a new e-mail builder.
        /// </summary>
        public AbstractEMailBuilder()
            : base()
        {
            this._To          = new EMailAddressList();
            this._ReplyTo     = new EMailAddressList();
            this._Cc          = new EMailAddressList();
            this._Bcc         = new EMailAddressList();
            this._Subject     = "";
            this.Date         = DateTime.Now;
            this._References  = new List <MessageId>();
            this._Attachments = new List <EMailBodypart>();

            this.SecurityLevel         = EMailSecurity.auto;
            this.SymmetricKeyAlgorithm = SymmetricKeyAlgorithms.Aes256;
            this.HashAlgorithm         = HashAlgorithms.Sha512;
            this.CompressionAlgorithm  = CompressionAlgorithms.Zip;

            _MailHeaders.Add(new KeyValuePair <String, String>("MIME-Version", "1.0"));
        }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Create a new e-mail address list.
 /// </summary>
 /// <param name="EMailAddressList">Another e-mail address list.</param>
 public EMailAddressList(EMailAddressList EMailAddressList)
 {
     this._MailAddressList = EMailAddressList != null
                                 ? new List <EMailAddress>(EMailAddressList)
                                 : new List <EMailAddress>();
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Add another e-mail address list to the e-mail address list.
        /// </summary>
        /// <param name="MailAddresses">A e-mail addresses list.</param>
        public EMailAddressList Add(EMailAddressList MailAddressList)
        {
            _MailAddressList.AddRange(MailAddressList._MailAddressList);

            return(this);
        }