Example of jmail email sending

Source: Internet
Author: User

In ASP Program Many emails are sent using jmail, mainly because most virtual hosts support it, while others support less.
The following is an example of jmail mail. Code :
If you try it on your machine, download jmail. dll, download and unzip it, and double-click setup. BAT to complete the installation! Copy code The Code is as follows: <%
On Error resume next
Dim jmail, contentid
Set jmail = server. Createobject ("jmail. Message ")
Jmail. charset = "gb2312" ''' character set, "US-ASCII" by default"
'''Jmail. isoencodeheaders = false''' indicates whether to perform ISO encoding. The default value is true.

''' Sender information (Value assignment using variables)
Jmail. From = "xiaoz@xiaoz.com" ''' sender address
Jmail. fromname = "xiaoz. com" ''' sender name
Jmail. Subject = "subject" ''' subject

''' Authentication
Jmail. mailserverusername = "myusername" ''' user name for authentication
Jmail. mailserverpassword = "mypassword" ''' authentication Password

''' Sets the priority from 1 to 5. The higher the priority, the higher the 3 is normal.
Jmail. Priority = 3

Jmail. addheader "originating-IP", request. servervariables ("remote_addr ")

''' Add a recipient. Variable Email: Recipient address. Multiple recipients can be added in the same statement.
Jmail. addrecipient ("xiaoz@xiaoz.com ")

''' Add the attachment. The variable filename is the absolute address of the attachment file. Make sure that the IUSR _ machine name has the permission to access the file]
''' [Whether the parameter is set to (true) or not (false) as the inline method]
''' Contentid = jmail. addattachment (server. mappath ("jmail. asp"), true)

''' Subject (HTML (note the attachment Link Method in the letter ))
Jmail. htmlbody = "<HTML>

''' Subject (text part)
Jmail. Body = "our emails are in HTML format, but your email viewing software may not support it... Body, body, body"

''' Send [Call format: objjmail. Send ([Username: password @] smtpserveraddress [: Port])]
Jmail. Send ("smtp.163.com ")

''' Close and clear the object
Jmail. Close ()
Set jmail = nothing

If err. Number <> 0 then
response. Write "failed to send! "
else
response. write" the email is sent successfully! "
end if
%>

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.