You often use the JMail component in your Web site to send mail. Simply put the commonly used functions as a module for easy invocation.
Put the program in a file and then include the call. (JMAIL4.3)
<% ' Warning function
Sub W_msg (Message,w_to,w_link)
' Message is the warning you want to eject, w_to=1 means to automatically back a page, when the w_to<>1 W_link represents the page to jump
If w_to= "1" Then
%>
<script language= "JavaScript" >
<!--
function Index () {window.alert (' <%=message%> '); History.back (-1)}
Index ();
-->
</script>
<%else%>
<script language= "JavaScript" >
<!--
function Index () {window.alert (' <%=message%> '); window.location= "<%=w_link%>"}
Index ();
-->
</script>
<%end if
End Sub%>
<%
Sub SendMail (Mailtitle,mailtext,mailaddress,mailcc,mailbcc,attachment,mailserver)
If mailtitle= "" Then
mailtitle= "System Test Mail"
End If
If mailtext= "" Then
mailtext= "Just a Test"
End If
If mailaddress= "" Then
Call W_msg ("mail address cannot be empty", "1", "")
End If
If mailserver= "" Then
Mailserver= "Smtp.163.com"
End If
Set Msg=server.createobject ("Jmail.message")
Msg.silent = True
Msg.logging = True
Msg. charset= "GB2312"
Msg. ContentType = "Text/html"
Msg. Mailserverusername= "YourUserName"
Msg. Mailserverpassword= "YourPassword"
Msg. From= "Youremail"
Msg. Fromname= "Dorryyang"
Mailaddress_s=split (MailAddress, ",") ' e-mail address used, lattice open
For i=0 to UBound (mailaddress_s)
Msg. AddRecipient Trim (mailaddress_s (i))
Next
If mailcc<> "" Then
Mailcc_s=split (MAILCC, ",")
For i=0 to UBound (mailcc_s)
Msg. ADDRECIPIENTCC Trim (mailcc_s (i))
Next
End If
If mailbcc<> "" Then
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service