Automatic mail can be sent to automatic mail to send script programs

xiaoxiao2021-03-06  66

Oh, I often have a friend who wants me to help them write a program that sends an email in the background. It is too much trouble. I wrote a code on my own server. After others use the server to send mail, I only need to be in myself. Simple writing and a line of reference code is OK! There is a premise: You must first install a mail to send components on your own server. I use Jmail, other components, and you can view the corresponding function description. Procedure. Program language: ASP (VBScript) My server address: http://211.23.12.12 (see this address is Du)

The server-side program Sendmail.asp code is as follows: '---------------------------------------- --------- XXX application Service provider automatic mail transmission system




<% 'mail server Information DIM SMTPSERVER, UserName, Passwordsmtpserver = "192.168.10.136" // SMTP server address username = "myusername" // server authentication user name Password = "mypassword" // server authentication password

'Determine User DIM CANOK, URLCANOK = 0URL = Request.ServerVariables ("http_referer")

'This expression indicates that the user http://www.liangdie.com is allowed to call this feature, and the detection calls this feature is http: //www.liangdie.comif MID (URL, 1, LEN ("http: // Www.liangdie.com ")) =" http://www.liangdie.com "the canok = 1END IF

'This expression indicates that the user http://www.jscy.cn is allowed to call this feature, the detection call this function page is http: //www.jscy.cnif MID (URL, 1, LEN ("http: // Www.jscy.cn ")) =" http://www.jscy.cn "the canok = 1END IF

'Note: If you need to add other authorized users, simply add the corresponding code to the corresponding code, you will start sending mail if canok = 1 THEN SET MSG = Server.createObject ("jmail.Message") msg.logging = true 'Log record msg.silent = true' error Open

Msg.From = request ("email") msg.fromname = request ("name")

Msg.addRecipient Request ("Recieve"), "" "

Msg.mailServerUserName = Username 'Enter SMTP Server Verify that the login name (email address of any of the post office) msg.mailserverpassword = password' Enter SMTP server verification password (user email account) msg.priority = 1 'email emergency Program, 1 is the fastest, 5 is the slowest, 3 is the default value msg.subject = request ("subject") msg.body = request ("body") if not msg.send (SMTPSERVER) THEN RESPONSE.WRITE "error" error Information:
"Response.write"

 "& msg.log &" 
 "else response.write"