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
%>