Nhu Nguyen
Nhu Nguyen

Reputation: 874

How to send mail using Openpop.net?

I using OpenPop.net to get mail from server, but i can't find method send mail in OpenPop.net, how to send mail in OpenPop.net?

Upvotes: 2

Views: 5415

Answers (2)

Raging Bull
Raging Bull

Reputation: 18747

I have been working on OpenPop.Net for quite a while. Here is a simple code for sending email using gmail account.

protected void btnSendMail_Click1(object sender, EventArgs e)
    {
        SmtpClient c = new SmtpClient("smtp.gmail.com", 587);
        MailAddress add = new MailAddress(txtReceiverEmailAddr.Text);
        MailMessage msg = new MailMessage();
        msg.To.Add(add);
        msg.From = new MailAddress(txtYourEmailAddr.Text);
        msg.IsBodyHtml = true;
        msg.Subject = txtSubject.Text;
        msg.Body = txtBody.Text;
        c.Credentials = new System.Net.NetworkCredential(txtYourEmailAddr.Text, txtYourPassword.Text);
        c.EnableSsl = true;
        c.Send(msg);
    }

Hope it helps.

Upvotes: 4

Igby Largeman
Igby Largeman

Reputation: 16747

POP3 is an email retrieval protocol. It is not used for sending. To send email, you need to use an SMTP client.

There is one in the .NET BCL: http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx

Upvotes: 4

Related Questions