SoFunction
Updated on 2025-03-09

asp+JMAIL implements sending email

This article uses asp and JMAIL to send emails. Are you curious about how this is implemented? Let’s find out with the editor!

document
What is a file? It is actually an optional file in which the program writer can specify event scripts and declare objects with session and application scopes. The contents of this file are not used to display to the user, but to store event information and objects used globally by the application. The name of the file must be and must be stored in the root directory of the application. Each application can only have one file. The content is as follows:

<script language="vbscript" runat="server">
sub Application_Onstart 'Initialization of the current number of online users and total number of visits.
Application("online")=0 
Application("counter")=0
End Sub
Sub session_Onstart
=5 'Set the web page expiration time to5minute

application("online")=application("online")+1
application("counter")=application("counter")+1

End Sub
Sub session_OnEnd

Application("online")=Application("online")-1

End Sub
</script>

Call the page code.

<%
 'Increase the current number of people limit processing, prompt the students, and send emails
 'Parameter description
'Subject: Email title
 'MailAddress : The address of the sending server,likesmtp.
'Email: The recipient's email address
 'Sender: Sender name
'Content : Email content
 'Fromer: The sender's email address
Sub SendAction(subject, email, sender, content)
Set JMail = ("")
 = "gb2312" ' Mail character set,Default is"US-ASCII"
 = strMailUser ' Sender address
 = sender' Sender name
 =subject
 = strMailUser' Authenticated username
 = strMailPass ' Password for authentication
 = 3'Send email type 1Special 3For ordinary
(email)
 = content
(strMailAddress)
End Sub
Dim title,strEmail,strMailAdress,strSender,strContent
DimstrMailAddress,strMailPass,strMailUser,JMail
if application("online")>=1 then
'Call thisSubExamples
title = Request("title")
strContent= "Hello, the number of people online is"&application("online")
strSender = Request("Name")'Sender's name
strEmail = "a375267603@" 'Recipient email address,Can be changed to Other email addresses
strMailAddress = "" 'Send server address  example:smtp.(for163Server address)
strMailUser = "zenghai@" 'Sender username
strMailPass = "8888" 'Send account password
Call SendAction (title,strEmail,strSender,strContent)
strShowMessage = "Module name: verifyStudent [Exceed the number of people limit] | Details: The number of people logged into the examination system has exceeded the server limit [" & application ("online") & "】, please log in later!"
end if
%>

Through this articledocumentWhat is and how to send emails, I hope it will be helpful to everyone's learning.