public static void Run()
        {
            // Create an instance of the Pop3Client class
            //ExStart:GettingMailboxInfo
            Pop3Client client = new Pop3Client();

            // Specify host, username, password, Port and SecurityOptions for your client
            client.Host            = "pop.gmail.com";
            client.Username        = "******";
            client.Password        = "******";
            client.Port            = 995;
            client.SecurityOptions = SecurityOptions.Auto;

            // Get the size of the mailbox,  Get mailbox info, number of messages in the mailbox
            long nSize = client.GetMailboxSize();

            Console.WriteLine("Mailbox size is " + nSize + " bytes.");
            Pop3MailboxInfo info          = client.GetMailboxInfo();
            int             nMessageCount = info.MessageCount;

            Console.WriteLine("Number of messages in mailbox are " + nMessageCount);
            long nOccupiedSize = info.OccupiedSize;

            Console.WriteLine("Occupied size is " + nOccupiedSize);
            //ExEnd:GettingMailboxInfo
            Console.WriteLine(Environment.NewLine + "Getting the mailbox information of POP3 server.");
        }
        public static void Run()
        {
            try
            {
                // Create a POP3 client
                Pop3Client client = new Pop3Client();

                // Basic settings (required)
                client.Host            = "pop.gmail.com";
                client.Username        = "******";
                client.Password        = "******";
                client.Port            = 995;
                client.SecurityOptions = SecurityOptions.SSLImplicit;

                // ExStart:CheckGmailMailboxStatus
                // Create an object of type Pop3MailboxInfo and Get the mailbox information, Check number of messages, and Check mailbox size
                Pop3MailboxInfo info;
                info = client.GetMailboxInfo();
                Console.WriteLine(info.MessageCount);
                Console.Write(info.OccupiedSize + " bytes");
                // ExEnd:CheckGmailMailboxStatus
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void Run()
        {
            //ExStart: AccessMailboxViaHTTPProxy
            HttpProxy proxy = new HttpProxy("18.222.124.59", 8080);

            using (Pop3Client client = new Pop3Client("imap.domain.com", "username", "password"))
            {
                client.Proxy = proxy;
                Pop3MailboxInfo mailboxInfo = client.GetMailboxInfo();
            }
            //ExEnd: AccessMailboxViaHTTPProxy
        }
    protected void brnSendEmail_Click(object sender, EventArgs e)
    {
        lblMessage.Text = "";

        try
        {
            // initialize pop3 client
            Pop3Client client = new Pop3Client();
            client.Host = txtHost.Text;
            client.Port = int.Parse(txtPort.Text);
            client.Username = txtUsername.Text;
            client.Password = txtPassword.Text;

            // SSL settings
            if (chSSL.Checked == true)
            {
                client.EnableSsl = true;
                client.SecurityMode = Pop3SslSecurityMode.Implicit;
            }

            // connect to pop3 server and login
            client.Connect(true);
            lblMessage.ForeColor = Color.Green;
            lblMessage.Text = "Successfully connected to SSL enabled POP3 Mail server.<br><hr>";

            // get mailbox information
            Pop3MailboxInfo mailboxInfo = client.GetMailboxInfo();
            long nMailboxSize = mailboxInfo.OccupiedSize;
            string strMailboxSize = "";

            // convert size in easy to read format
            if (nMailboxSize <= 1024)
                strMailboxSize = nMailboxSize.ToString() + " bytes";
            else if (nMailboxSize > 1024 && nMailboxSize <= (1024 * 1024))
                strMailboxSize = nMailboxSize.ToString() + " bytes (approx " + Math.Round((double)nMailboxSize / 1024, 2).ToString() + " KB)";
            else
                strMailboxSize = nMailboxSize.ToString() + " bytes (approx " + Math.Round((double)nMailboxSize / (1024 * 1024), 2).ToString() + " MB)";

            lblMailboxSize.Text = strMailboxSize;
            lblMessageCount.Text = mailboxInfo.MessageCount.ToString() + " messages found";

            client.Disconnect();
        }
        catch (Exception ex)
        {
            lblMessage.ForeColor = Color.Red;
            lblMessage.Text = "Error: " + ex.Message;
        }
    }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir  = RunExamples.GetDataDir_POP3();
            string dstEmail = dataDir + "1234.eml";

            //Create an instance of the Pop3Client class
            Pop3Client client = new Pop3Client();

            //Specify host, username and password for your client
            client.Host = "pop.gmail.com";

            // Set username
            client.Username = "******";

            // Set password
            client.Password = "******";

            // Set the port to 995. This is the SSL port of POP3 server
            client.Port = 995;

            // Enable SSL
            client.SecurityOptions = SecurityOptions.Auto;

            // Get the size of the mailbox
            long nSize = client.GetMailboxSize();

            Console.WriteLine("Mailbox size is " + nSize + " bytes.");
            // Get mailbox info

            Aspose.Email.Pop3.Pop3MailboxInfo info = client.GetMailboxInfo();

            // Get the number of messages in the mailbox
            int nMessageCount = info.MessageCount;

            Console.WriteLine("Number of messages in mailbox are " + nMessageCount);

            // Get occupied size
            long nOccupiedSize = info.OccupiedSize;

            Console.WriteLine("Occupied size is " + nOccupiedSize);

            Console.WriteLine(Environment.NewLine + "Getting the mailbox information of POP3 server.");
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_POP3();
            string dstEmail = dataDir + "1234.eml";

            //Create an instance of the Pop3Client class
            Pop3Client client = new Pop3Client();

            //Specify host, username and password for your client
            client.Host = "pop.gmail.com";

            // Set username
            client.Username = "******";

            // Set password
            client.Password = "******";

            // Set the port to 995. This is the SSL port of POP3 server
            client.Port = 995;

            // Enable SSL
            client.SecurityOptions = SecurityOptions.Auto;

            // Get the size of the mailbox
            long nSize = client.GetMailboxSize();

            Console.WriteLine("Mailbox size is " + nSize + " bytes.");
            // Get mailbox info

            Aspose.Email.Pop3.Pop3MailboxInfo info = client.GetMailboxInfo();

            // Get the number of messages in the mailbox
            int nMessageCount = info.MessageCount;

            Console.WriteLine("Number of messages in mailbox are " + nMessageCount);

            // Get occupied size
            long nOccupiedSize = info.OccupiedSize;

            Console.WriteLine("Occupied size is " + nOccupiedSize);

            Console.WriteLine(Environment.NewLine + "Getting the mailbox information of POP3 server.");
        }
Example #7
0
        public static void Run()
        {
            // ExStart:RetrieveEmailViaPop3ClientProxyServer
            Pop3Client client = new Pop3Client("pop.domain.com", "username", "password");

            // Set proxy address, Port and Proxy
            string     proxyAddress = "192.168.203.142";
            int        proxyPort    = 1080;
            SocksProxy proxy        = new SocksProxy(proxyAddress, proxyPort, SocksVersion.SocksV5);

            client.Proxy = proxy;

            try
            {
                Pop3MailboxInfo mailboxInfo = client.GetMailboxInfo();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            // ExEnd:RetrieveEmailViaPop3ClientProxyServer
        }
        public static void Run()
        {
            // Create an instance of the Pop3Client class
            //ExStart:GettingMailboxInfo
            Pop3Client client = new Pop3Client();
            // Specify host, username, password, Port and SecurityOptions for your client
            client.Host = "pop.gmail.com";
            client.Username = "******";
            client.Password = "******";
            client.Port = 995;
            client.SecurityOptions = SecurityOptions.Auto;

            // Get the size of the mailbox,  Get mailbox info, number of messages in the mailbox
            long nSize = client.GetMailboxSize();
            Console.WriteLine("Mailbox size is " + nSize + " bytes.");
            Pop3MailboxInfo info = client.GetMailboxInfo();
            int nMessageCount = info.MessageCount;
            Console.WriteLine("Number of messages in mailbox are " + nMessageCount);
            long nOccupiedSize = info.OccupiedSize;
            Console.WriteLine("Occupied size is " + nOccupiedSize);
            //ExEnd:GettingMailboxInfo
            Console.WriteLine(Environment.NewLine + "Getting the mailbox information of POP3 server.");
        }