<% 'By Dicky QQ: 25941
Function jmail (send_from, send_to, send_subject, send_body)
'Call the jmail component
'Send email Function
'Metric data:
'Send _ from-sender's mailbox
'Send _ to-receiver mailbox
'Send _ subject-Subject
'Send _ body-response content
Dim jmail
Set jmail = server. Createobject ("jmail. Message ")
Jmail. charset = "gb2312" 'mail character set, "US-ASCII" by default"
'Jmail. isoencodeheaders = false' indicates whether to perform ISO encoding. The default value is true.
'Sender information (assign values using variables)
Jmail. From = send_from 'sender's mailbox
Jmail. fromname = "Administrator" 'sender name
Jmail. Subject = send_subject 'subject
'Authentication
'Jmail. mailserverusername = "user" 'user name for authentication
'Jmail. mailserverpassword = "password" 'password for authentication
'Set the priority, range 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 one receiver [variable send_from: Recipient address] multiple recipients can be added in the same statement.
Jmail. addrecipient (send_from)
'Subject (HTML (note the attachment Link Method in the letter ))
Jmail. htmlbody = ubbcode (send_body)
Jmail. Body = htmldecode (ubbcode (send_body ))
'Send [Call format: objjmail. Send ([Username: password @] smtpserveraddress [: Port])]
'Jmail. Send ("User: password@smtp.21cn.com ")
Sendinfo = jmail. Send (send_to)
'Close and clear the object
Jmail. Close ()
Set jmail = nothing
End Function
Function send_mail (send_from, send_to, send_subject, send_body)
'Call the built-in newmail component in Windows
'Send email Function
'Metric data:
'Send _ from-sender's mailbox
'Send _ to-receiver mailbox
'Send _ subject-Subject
'Send _ body-response content
Dim mailobject
Set mailobject = server. Createobject ("cdonts. newmail ")
Mailobject. bodyformat = 0
Mailobject. mailformat = 0
Mailobject. From = send_from
Mailobject. To = send_to
Mailobject. Subject = send_subject
Mailobject. Body = send_body
Mailobject. Send ()
Set mailobject = nothing
If err then
Response. Write "<script language = JavaScript> alert ('error:" & err. Number & err. Description & "sorry, an error occurred while sending the email! :( '); </SCRIPT>"
Else
Response. Write "<script language = JavaScript> alert ('Congratulations, the email is sent successfully! __^ '); </SCRIPT>"
End if
End function %>