Jmail|jmail often use the JMail component in the 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
Mailbcc_s=split (MAILBCC, ",")
For i=0 to UBound (mailbcc_s)
Msg. ADDRECIPIENTBCC Trim (mailbcc_s (i))
Next
End If
If attachment<> "" Then
Msg. AddAttachment (attachment) ' Attachment write attachment address
End If
Msg. Subject=mailtitle
Msg. Htmlbody=mailtext
Msg. Send (MailServer)
Msg.close
Set msg=nothing
Call W_msg ("Send Success", "1", "")
End Sub
%>