Jmail|mail Components | functions | Online <% ' by Dicky qq:25941
Function JMail (Send_from,send_to,send_subject,send_body)
' Invoke the JMail component
' Send e-mail function
' Parameters:
' send_from-sent to the mailbox
' send_to-recipient's mailbox
' send_subject-Email Topic
' Send_body-Email content
Dim JMail
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 = Send_from ' sender's mailbox
Jmail.fromname = "Administrator" sender name
Jmail.subject = Send_subject ' message subject
' Authentication
' Jmail.mailserverusername = ' user ' authenticated username
' Jmail.mailserverpassword = ' password ' 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 Send_from: Recipient address ' can be repeated by adding multiple
Jmail.addrecipient (Send_from)
' Message body (HTML (note how attachments are linked within a letter)
Jmail.htmlbody = Ubbcode (send_body)
Jmail.body = HtmlDecode (Ubbcode (send_body))
' Send ' call format: Objjmail.send ([username:password@]smtpserveraddress[:P ort])
' 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 Windows Self-newmail component
' Send e-mail function
' Parameters:
' send_from-sent to the mailbox
' send_to-recipient's mailbox
' send_subject-Email Topic
' Send_body-Email 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, The email was sent to fail! : (');</script> "
Else
Response.Write "<script Language=javascript>alert" (' Congratulations, email sent success! ^_^ ');</script> "
End If
End Function%>