JMail a letter instance that can be invoked directly

Source: Internet
Author: User
<!--jmail.asp-->
<script Language=vbscript runat=server>
function SendMail (smtpserver,sender,mailto,subject,msg) ' This is a function that can be called directly in a program.
Dim JMail
' On Error Resume Next
' Wait function expands
Set JMail = Server.CreateObject ("Jmail.smtpmail")
Jmail.lazysend = True ' This property is to put the message in a buffer until it is sent, without any error message
Jmail.charset = "Euc-kr" Set the character set of the message, default to "Us-ascii" General Chinese with "gb2312"
Jmail.contenttype = "Text/html" The header of this message is set, the default is "Text/plain" can be set to any situation you need.
' You want to send HTML information, change this header file to ' text/html '
The address of the jmail.serveraddress =smtpserver ' server. Can have a lot of server addresses, followed by the port number
Jmail.sender = Sender ' mailing address
Jmail.subject = Subject ' The title of the message.
Jmail.addrecipient mailto ' Add a recipient
Jmail.body = Msg ' Ubbcode (HTMLEncode (msg)) e-mail body
jmail.priority = 1 ' message priority, which can range from 1 to 5. The greater the priority is about high, for example, 5 highest, 1 lowest, generally set to 3
Jmail.addheader "Originating-ip", Request.ServerVariables ("remote_addr") ' AddHeader Add a header message
' Remote_addr the IP address of the machine that made the request
Jmail.execute ' Execute mail to server
Set jmail=nothing
If Err then ' detect
Sendmail=err.description
Err.Clear
Else
Sendmail= "OK"
End If
End Function
</script>
<%
' Call Description:
strhtml = "<table width=" "80%" "border=" "1" ">" &AMP;CHR (10) ' There is a need to add two '
strHTML = strhtml & "<tr>" &AMP;CHR (+) &AMP;CHR ' Chr (13) Hard return Chr (10) Soft return
strHTML = strhtml & "<td align=" "Center" "valign=" "Middle" ">HELLO~!</td>" &AMP;CHR (a) &AMP;CHR (10)
strHTML = strhtml & "</tr>" &AMP;CHR (+) &AMP;CHR (10)
strHTML = strhtml & "</table>"
Smtpserver= "Mail.sh163.net:25"
Sender= "Juliet@sh163.net"
subject= "hey!"
Msg= "<HTML><BODY><CENTER>" & strhtml & "</CENTER></BODY></HTML>"
Mailto=email ' email to the addressee.
Call SendMail (smtpserver,sender,mailto,subject,msg) ' Invoke function
%>

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.