예제 #1
0
        public EmailMessage(string uid, Chilkat.Email msg)
        {
            _toAddr   = msg.GetTo(0);
            _fromAddr = msg.From.ToString();
            _bcc      = "";

            for (int i = 0; i <= msg.NumCC - 1; i++)
            {
                _bcc += msg.GetCC(i) + " ";
            }
            _subject      = msg.Subject;
            _receiveDate  = msg.EmailDate;
            _filename     = null;
            _message      = msg.GetPlainTextBody();
            _UID          = msg.Uidl;
            _emailMessage = msg;
        }
예제 #2
0
        public void fetchMessage(SmtpConfig smtpAcct)
        {
            string Username;
            string Password;
            string Host;
            int    Port;
            string Email;
            bool   SSL;
            bool   TSL;
            long   authenticationType;


            Chilkat.MailMan mailman = new Chilkat.MailMan();
            bool            success = mailman.UnlockComponent("BARTMNMAILQ_3K24X6hk7C2J");

            if (!success)
            {
                MessageBox.Show("Could not initialize email component");
                return;
            }

            if (smtpAcct != null)
            {
                Username           = smtpAcct.in_userName;
                Password           = smtpAcct.in_password;
                Host               = smtpAcct.in_server;
                Port               = smtpAcct.in_port;
                Email              = smtpAcct.emailAddress;
                SSL                = smtpAcct.in_SSL;
                TSL                = smtpAcct.in_TSL;
                authenticationType = smtpAcct.in_authentication;
            }
            else
            {
                GlobalShared.Log.Log((int)LogClass.logType.Warning, "No POP configuration found", false);
                return;
            }

            mailman.MailHost = Host;
            //TCP port for connection
            mailman.MailPort = (ushort)Port;
            //Username to login to the POP3 server
            mailman.PopUsername = Username;
            //Password to login to the POP3 server
            mailman.PopPassword = Password;
            // SSL Interaction type
            if (TSL)
            {
                mailman.StartTLS = true;
            }
            else if (SSL)
            {
                mailman.PopSsl = true;
            }
            try
            {
                _emailMessage = mailman.FetchEmail(_UID);
                _message      = _emailMessage.GetPlainTextBody();
            }
            catch (System.Exception ex)
            {
            }
            finally
            {
                mailman = null;
            }
        }