ASP calls the JMail component to send mail

Source: Internet
Author: User
Tags character set mail
Jmail|jmail Components | sending mail in the ASP program in the JMail email more, mainly because most of the virtual host support him, other support is less. The following is an example code for JMail email:

If you try on your own machine, please download Jmail.dll, download decompression, double-click Setup.bat to complete the installation!

<%
On Error Resume Next
Dim JMail, ContentID
Set JMail = Server.CreateObject ("Jmail.message")
Jmail.charset = "gb2312" message character set, default to "Us-ascii"
' Jmail.isoencodeheaders = False ' is ISO-encoded, default to True

' Sender information (available in variable mode assignment)
Jmail.from = "Someone@51windows.net" ' Sender address
jmail.fromname = "hai Eva" ' Sender's name
Jmail.subject = "Mail subject" ' Message subject

' Authentication
Jmail.mailserverusername = "MyUserName" Authenticated user name
Jmail.mailserverpassword = "MyPassword" Authenticated password

' Set priority, range from 1 to 5, higher priority, 3 normal
Jmail.priority = 3

Jmail.addheader "Originating-ip", Request.ServerVariables ("REMOTE_ADDR")

' Add a recipient ' variable email: recipient address ' can be repeated by adding multiple
Jmail.addrecipient ("someone@somehost.com")

' Add attachment ' variable filename: The absolute address of the attachment file to ensure that the user IUSR_ the machine name has access permission "
' "Parameter setting is (True) No (False) is inline mode"
' ContentID = jmail.addattachment (Server.MapPath ("jmail.asp"), True)

' Message body (HTML (note how attachments are linked within a letter)
Jmail.htmlbody = "

' Message body (text section)
Jmail.body = "Our mail is in HTML format, but your mail viewing software may not support ... Message body, message body, message body "

' Send ' call format: Objjmail.send ([username:password@]smtpserveraddress[:P ort])
Jmail.send ("smtp.163.com")

' Close and clear the object
Jmail.close ()
Set JMail = Nothing

If Err.number<>0 Then
Response.Write Send send failed! "
Else
Response.Write "Mail sent successfully! "
End If
%>



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.