JMAIL to send simple mail under .NET.

xiaoxiao2021-03-17  196

Jmail is a third-party component, so you need to get it before use. You can download the installation package from the Internet, the size is approximately 1.5m, after the installation is complete, you can add Jamil.dll references in your project.

Sending an email using Jmail is simple, below is the related code:

Using jmail;

Private void page_load (object sender, system.eventargs e) // is not necessarily load event {

JMail.Message Jimentage = new jmail.MessageClass (); jimentage.charset = "gb2312";

JMessage.From = "chp@superweb.cn"; // Sending address JMessage.FromName = "Xiao Cheng Comrade"; // Sender

JMessage.ReplyTo = "chp@superweb.cn"; // Reply address

JMessage.Subject = "Here is the title"; // message headline jimentage.addrecipient ("cfanwolf@gmail.com", "," "); // is the receiver address, the back two parameters can be empty!

// AddRecipient (emaildress, recipientname, pgpkey) // Add a recipient to the email. RecipientName and PGPKey are optional, RecipientName is encrypted by the recipient name, PGPKey gives mail.

JMessage.Body = "This is the message content"; // Letter content

JMessage.mailServerUserName = "****"; / / User name to the mailbox, JMessage.mailServerPassword = "*****"; / / to log in to the mailbox

JMessage.send ("10.0. ***. **", false); // ip is the mail server response.write ("Email Sent Success"; JMESSAGE.CLOSE ();

}

For details, please see http://www.chinaaspx.com/comm/dotNetbbs/showtopic.aspx?forum_id=30&id=16510

转载请注明原文地址:https://www.9cbs.com/read-129666.html

New Post(0)