Mail in asp.net-practical tips

Source: Internet
Author: User

Now most of the mail to be validated, I write this article is to help you develop projects, and I hope you can give me some advice.

Refer the JMail to the project and join the JMail namespace, where I will refer to the MessageClass class of the JMail package.

Logging property: Log is used

Silent property: If set to True,jmail, no exception error is thrown. JMail. Send (() returns TRUE or false based on the action result

Mailserverusername property: The user name of the sender, such as:abcdef@163.com;

Mailserverpassword Property: Sender's password

From attribute: Sender

Subject Properties: Topics

AddAttachment () Method: Attaching Files

Body property: Message text.

The following is a complete example:

public bool SendMail ()

{

MessageClass email = new MessageClass ();

Email. Logging = true;

Email. Silent = true;

Email. Mailserverusername = "abcdef@163.com";

Email. Mailserverpassword = "124";

Email. from = "abcdef@163.com";

Email. Subject = "JMail";

Email. AddAttachment ("C:\\test.xml", True, "");

Email. BODY = "Test jmail send Mail";

Email. AddRecipient ("abcdef@163.com", "abc", NULL);

return email. Send ("mail.163.com", false)

}

Author: Pan Min

E-mail:jspanmin@jcc-net.com

Msn:jspanmin@163.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.