ASP online E-mail 2 functions (using Jmail and Newmail components)

xiaoxiao2021-03-06  42

<% 'By Dicky QQ: 25941Function JMail (Send_From, Send_To, Send_Subject, Send_Body)' call JMail assembly 'Send E-mail functions' parameter: 'Send_From- mail sender' Send_To- mail recipients 'Send_Subject- message subject' Send_Body - Mail content DIM JMAIL Set Jmail = Server.createObject ("jmail.message")

JMail.Charset = "GB2312" mail character set, default is "US-ascii" 'jmail.isoencodeheaders = false' Do ISO code, default is true

'Sender information (available variable method assignment) jmail.from = send_from' sender mailbox jmail.fromname = "Admin" sender name Jmail.Subject = send_subject 'mail topic

'Authentication' Jmail.mailServerUserName = "User" 'authenticated user name' jmail.mailserverpassword = "password" 'authentication password

'Setting the priority, the higher from 1 to 5, the higher the priority, 3 is ordinary jmail.priority = 3

Jmail.addheader "Originating-IP", Request.ServerVariables ("remote_addr")

'Join a recipient [Variable Send_From: Recipient Address] You can repeat multiple jmail.addrecipient (HTML (Note) "JMail.htmlbody = Ubbcode (SEND_BODY) ) JmLDecode (ubcode (send_body))

'Send [call format: objjmail.send ([username: password @] SMTPSERVERVERADDRESS [: Port])]' Jmail.send ("User: Password@smtp.21cn.com") Sendinfo = Jmail.send (Send_to)

'Close and clear the object jmail.close () set jmail = nothingend function

Function Send_Mail (Send_From, Send_To, Send_Subject, Send_Body) 'call comes NewMail Windows Components' Send E-mail function' argument: 'Send_From- mail sender' Send_To- mail recipients' Send_Subject- mail subject 'Send_Body- message 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 = Nothingif err thrit "