Esempio n. 1
0
        public void Process(MyEmailEventArgs e)
        {
            Console.WriteLine("Forwarding message {0}!!!", e.Subject);
            Chilkat.Email mail = mailMan.FetchEmail(e.Uidl);
            if (mail == null)
            {
                Console.WriteLine("Cannot get the remail {0}", e.Uidl);
                return;
            }
            Chilkat.Email forwardMail = mail.CreateForward();
            forwardMail.From = "*****@*****.**";
            forwardMail.AddTo("Thao Vo", "*****@*****.**");
            bool success = mailMan.SendEmail(forwardMail);

            if (success == false)
            {
                Console.WriteLine(mailMan.LastErrorText);
            }

            PostProcessCommand(e);
        }
Esempio n. 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;
            }
        }