ASP. NET-Email sending

Source: Internet
Author: User
Tags mailmessage smtpclient

Jmail
[Download jmail. dll]
Step 1: Register jmail

Method 1: windows --> Run --> cmd --> Cd jmail directory --> regsvr32 jmail. dll --> Registration successful

Method 2: Copy jmail. DLL to c: \ windows \ system32, and then enter regsvr32 jmail. dll in the running state.
Step 2: Reference
Reference com to build jmail 4.0 Library
Step 3: Code

Jmail. Message JM = new jmail. Message ();
JM. Silent = true;
JM. Logging = true;
JM. Subject = "test ";
JM. charset = "gb2312 ";
JM. contenttype = "text/html ";
JM. From = "sjoem@sjoem.com ";
JM. replyto = "sjoem@sjoem.com ";
JM. fromname = "Lidi ";
JM. mailserverusername = "username ";
JM. mailserverpassword = "PWD ";
JM. Body = "test ";
JM. addrecipient ("lidi@sjoem.com ","","");
If (JM. Send ("mail.sjoem.com", false ))
Response. Write ("success ");
Else
Response. Write ("fail ");

Smtpclient sent by

Using system. net. mail;

Mailmessage = new mailmessage ();
String strbody;
// Sending Address
Mailmessage. From = new mailaddress ("shasibingdu@163.com ");
// Receiving address
Mailmessage. to. Add ("ldgg@vip.qq.com ");
// Mail title
Mailmessage. Subject = "test ";
// Email content
Strbody = "Haha ";
Mailmessage. Body = strbody;
Smtpclient = new smtpclient ();
// Smtpclient. enablessl = true;
// SMTP Server
Smtpclient. Host = "smtp.163.com ";
// SMTP server sending Port
Smtpclient. Port = 25;
// Send the user name and password
Smtpclient. Credentials = new networkcredential ("username", "PWD ");
Try
{
// Call the sending Function
Smtpclient. Send (Mail );
Label1.text = "OK ";
}
Catch
{
Label1.text = "false ";
}
Related Article

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.