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 ";
}