[Original] functions of using jmail in ASP

Source: Internet
Author: User

'*************************************** **************************************** *****

'Author: loster (OICQ: 181306) [do not delete this information if it is reprinted. Thank you!]

'Function name: send_email ()

'Purpose: Use the jmail4.3 component to send e-mail

'Parameter:

'Email: Type: string. Purpose: Address of the email recipient.

'E _ subject: Type: string. Role: subject of a letter.

'Information: Type: string. Role: content of the letter.

'S _ type: Type: Boolean value. Purpose: whether the email is in HTML format. True is in HTML format. False is in text format.

'C _ m_chk: Type: Boolean value. Role: whether the SMTP server requires authentication

'If the message is sent successfully, the function returns true. Otherwise, false is returned.

'*************************************** **************************************** *****

Function send_email (email, e_subject, information, s_type, c_m_chk)

Const c_email = "'sender's mailbox

Const c_hostname = "'sender's name

Const c_smtp = "smtp.xxx.com" 'smtp server address

Const c_m_user = "'If the SMTP server needs to authenticate the identity, enter the user name

Const c_m_pass = "" enter the password

Dim sender
Err. Clear
On Error resume next
If email = "" or information = "" Or e_subject = "" then
Send_email = false
Exit Function
End if
Set sender = server. Createobject ("jmail. Message ")
Sender. Logging = true
Sender. From = c_email
Sender. fromname = c_hostname
Sender. addrecipient email
Sender. Subject = e_subject
If s_type = false then
Sender. appendtext Information
Else
Sender. appendhtml Information
End if
Sender. maildomain = c_smtp
If c_m_chk = true then
Sender. mailserverusername = c_m_user
Sender. mailserverpassword = c_m_pass
End if
Sender. Priority = 1
Sender. Send (c_smtp)

If err. Number <> 0 then
Send_email = false
Else
Send_email = true
End if
Err. Clear
End Function

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.