program | I used to have friends who asked me to write a server in the background to send mail program, too troublesome, on my own server to write a piece of code, then someone else to use the server to send mail, only in their own program to write a single line of reference code on the OK! 
 
There is a prerequisite: You must first install a mail delivery component on your own server, I use JMail, other components, can see the corresponding function instructions to modify my program can be. 
 
 
Program language: ASP (VBScript) 
My server address: http://211.23.12.12 (this address is fabricated for confidentiality purposes) 
 
 
The server-side program sendmail.asp code is as follows: 
'------------------------------------------------- 
<font size=2 color=green>xxx Application Service provider automated mail delivery system </font> 
<HR height=1> 
<BR><BR> 
<% 
' Mail send server information 
Dim Smtpserver,username,password 
Smtpserver= "192.168.10.136"//SMTP server address 
Username= "MyUserName"/server Authentication user name 
password= "MyPassword"/server Authentication password 
 
' Judge the users who use this feature 
Dim Canok,url 
Canok=0 
Url=request.servervariables ("Http_referer") 
 
' This expression indicates that the user http://www.liangdie.com is allowed to invoke this feature and detects whether the call to this feature page is http://www.liangdie.com 
If Mid (Url,1,len ("http://www.liangdie.com")) = "Http://www.liangdie.com" Then 
Canok=1 
End If 
 
' This expression indicates that the user http://www.jscy.cn is allowed to invoke this feature and detects whether the call to this feature page is http://www.jscy.cn 
If Mid (Url,1,len ("http://www.jscy.cn")) = "http://www.jscy.cn" Then 
Canok=1 
End If 
 
' NOTE: If you need to add other authorized users, just follow the syntax above, add the appropriate code can be 
 
' Start sending mail 
If Canok=1 Then 
Set msg = Server.CreateObject ("Jmail.message") 
Msg. Logging = True ' log record 
Msg.silent = True ' error turned on 
 
Msg. From = Request ("email") 
Msg. FromName = Request ("name") 
 
Msg. AddRecipient request ("recieve"), "" 
 
Msg. Mailserverusername = Username ' Enter SMTP server Authentication login (email address of any user in post office) 
Msg. Mailserverpassword = Password ' Enter SMTP server authentication password (password for user email account) 
Msg. Priority = 1 ' Mail emergency program, 1 for fastest, 5 for slowest, 3 for default value 
Msg. Subject = Request ("Subject") 
Msg. Body=request ("Body") 
If not MSG. Send (SmtpServer) Then 
Response.Write "error Message:<br>" 
Response.Write "<pre>" & Msg.log & "</pre>" 
Else 
Response.Write "<meta Http-equiv=refresh content= ' 3; Url= "& URL &" ' > ' 
Response.Write "<p Align=center><font size=2 color=black> Mail sent successfully! return automatically after 3 seconds! </font></p> " 
 
End If 
 
Else 
Response.Write "<p align=center><font size=2 color=red> Illegal user or unauthorized user! </font></p> " 
Response.End 
End If 
%> 
<HR height=1> 
'------------------------------------------------- 
 
 
 
The http://www.jscy.cn/feedback.htm code at the call is as follows: 
------------------------------------------------- 
<form name= "form" method= "get" action= "http://211.23.12.12/SendMail.asp" > 
<input type=text name=email value= "customer@liangdie.com" > 
<input type=text name=name value= "customer@liangdie.com" > 
<input type=text name=body value= "" > 
<input type=text name=subject value= "" > 
<input type= "Submit" name= "Submit" value= "submitted" onclick= "sendmsg.style.visibility= ' Visible '" > 
<input type= "reset" name= "Submit2" value= "clear" > 
<p id=sendmsg align=center style= "Visibility:hidden" ><font color=red> Mail is being sent, please wait ......</font>< /p> 
</form> 
------------------------------------------------- 
Note: Before sending, you must check whether the email variable is an email format, or the sending program will report an error. In most cases, the form information sent by the customer may be numerous and can be scripted into a body variable and then submitted to the server. 
 
 
Oh, actually finished this program, feel a bit similar to the basic concept of Web service, of course, if purely from the technical point of view of this program, and Web service technology to achieve the difference is too far, but the way to use a bit similar.