JMail components to send mail the absolute function of the use of _ Application techniques

Source: Internet
Author: User
Roughly as follows:

The 1,pop3 object is the operation of the POP3 mail receiving server.
2,messages object, which is an object about a collection of messages.
The 3,message object, which is the object of the message, is the most commonly used object of the JMail component to send mail messages and receive message information.
4,header object, which is the object associated with the message header.
5,recipients object that is the object that receives the collection of messages.
6,recipient object, which is about the object that receives the message.
7,attachments object, which is an object about a collection of message attachments.
8,attachment object, which is an object for message attachments.
9,mailmerge object that is the object for the mail template.
10,pgpkeys object that is an object for a collection of mail PGP keys.
11,pgpkeyinfo object, which is an object about message PGP key information.
......

In a Web application where mail is sent, the message object is the most common and needs to be created and assigned to a variable before it is used.


Set JMail = Server.CreateObject ("JMail. Message ")


The Message object has the following commonly used properties and method applications:

The 1,silent property, which indicates a mask exception error, returns a value of false or true, indicating that the message sends ignores the error and does not return the error message to the operating system.
Jmail.silent = True

2,logging property, which indicates whether logging is enabled.
Jmail.logging = True

3,charset property, set the character set that the message displays, Chinese simplified can use GB2312.
JMail. Charset = "GB2312"

4,contenttype property that represents the type of message body.
JMail. ContentType = "Text/html"

5,addrecipient method that represents the e-mail address of the recipient.
JMail. AddRecipient ("cnbruce@126.com")

6,from property that represents the e-mail address of the sender. This address is generally the same as the login account required to authenticate with the SMTP server.
JMail. from = "Dw8asp@126.com"

7,fromname property that represents the sender's name.
JMail. FromName = "Brucewolf"

The 8,subject property, which indicates the title of the setting to send the message.
JMail. Subject = "This is the title of the message"

The 9,body property, which indicates the body content of the sending message, can be used with HTML tag code
JMail. BODY = "This is the content of the message <br> line-wrapping display"

The 10,priority property, which indicates the priority of the message sent, 1 is the fastest, 5 is the slowest, and 3 is the default value.
JMail. Priority = 1

The 11,mailserverusername property, which represents the logon account that is set when the mail server uses SMTP to send authentication.
JMail. Mailserverusername = "Dw8asp@126.com"

The 12,mailserverpassword property, which indicates the login password that is set when the mail server uses SMTP to send authentication.
JMail. Mailserverpassword = "**************"

13,send method that represents the sending of a message through a specified mail sending server. Note that the mail server address is consistent with the values in Mailserverusername and Mailserverpassword.
JMail. Send ("smtp.126.com")

14,close method that represents the cache space used to free jmail and mail server connections.
JMail. Close ()

Because of the different mail servers, the difference between the sender of the message, and the difference between the headers and the content of the message, the function of customizing the following functions is used to complete the function of JMail to send messages, combining these frequently changing values.

JMail Mail-sent functions


<%
Function Send_email (smtphost,smtpuser,smtppass,mailto,fromname,subject,content)
Set JMail = Server.CreateObject ("JMail. Message ")
Jmail.silent = True
Jmail.logging = True
JMail. Charset = "gb2312"
JMail. ContentType = "Text/html"
JMail. AddRecipient MailTo
JMail. From = Smtpuser
JMail. FromName = FromName
JMail. Subject = Subject
JMail. BODY = Content
JMail. Priority = 1
JMail. Mailserverusername = Smtpuser
JMail. Mailserverpassword = Smtppass
JMail. Send (SMTPHost)
JMail. Close ()
Response.Write ("Mail sent successfully")
End Function
%>



Where Send_email represents a custom function name
Parameter SMTPHost represents the mail server address
Parameter Smtpuser indicates the login account required for letter verification
Parameter smtppass indicates the login password required for letter verification
Parameter mailto represents the e-mail address of the recipient of the message
Parameter FromName represents the name of the sender of the message
and the parameter subject and content represent the message's title and body contents respectively.

You can apply this function by using the following methods:
Call Send_email (" smtp.126.com"," dw8asp@126.com "," Hu Jintao "," cnbruce@msn.com "," Cnbruce "," title "," Message body content ")

Or have Personal Post OfficeThe available
Call Send_email (" mail.cnbruce.com"," root@cnbruce.com "," Hu Jintao "," cnbruce@msn.com "," Cnbruce "," title "," Message body content ")

JMail Component Download Address: http://www.jb51.net/softs/26125.html

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.