ASP mail Send plug-in JMail all method attributes

Source: Internet
Author: User
Tags base64 character set zip port number

JMail List of main parameters

You should first create a jmail.message image:

Set jmail = Server.CreateObject ("Jmail.message")

Then the other parameters of the JMail are manipulated.

(1) Body (letter): string
such as: Jmail.body = "This can be a user filled out form content, can be taken from." ”
(2) Charset (character set, default "Us-ascii"): string
such as: Jmail.charset = "Us-ascii"
(3) Contenttransferencoding: string
Specifies the encoding for content transfer, by default, "Quoted-printable"
such as: jmail.contenttransferencoding = "base64"
(4) ContentType (Contentype of the letter. Default is "Text/plain"): string
If you send the message in HTML format, change to "text/html".
such as: Jmail.contenttype = "text/html"
(5) Encoding: string
Set the Attachment encoding method (default is "base64"). You can choose to use the "Base64″," uuencode "or" quoted-
Printable "
such as: jmail.encoding = "base64"
(6) log (JMail created by the Loging property set to True, see below): string
For example, use the Response.Write (JMAIL.LOG) statement to list log information.
(7) Logging (use log): Boolean
such as: Jmail.logging = True
(8) Recipients: string
Read-only property, returning all recipients
such as: Response.Write ("" + Jmail.recipients + "");
(9) ReplyTo (Specify another return address): string
such as: Jmail.replyto = "anyother@mailhost.com"
(ten) Sender (sender's email address): string
such as: Jmail.sender = "sender@mailhost.com"
(one) sendername (name of sender): string
such as: Jmail.sendername = "one gram"
() serveraddress (address of mail server): string
You can specify more than one server, with a semicolon point to open. You can specify a port number.
If the serveraddress remains blank, JMail will try the Remote mail server and send it directly to the server.
such as: jmail.serveraddress = "mail.263.net.cn"
(Subject) (set the title of the message, which can be taken from.) ): String
such as: Jmail.subject = "Customer Feedback form"
(14) Add file attachment to the mail, (Note: C disk under the file, security needs to be changed to network users, can be recognized)
such as: Jmail.addattachment ("C:\anyfile.zip")
(addcustomattachment) (FileName, Data)
Add custom attachments.
such as: Jmail.addcustomattachment ("Anyfile.txt", "Contents of File");
(AddHeader) (Header, Value)
Adds a user-defined letter header.
such as: Jmail.addheader ("Originating-ip", "192.168.10.10″");
(addrecipient): string
such as: Jmail.addrecipient ("info@dimac.net");
(a) ADDRECIPIENTBCC (Email), confidential recipient:
such as: JMAIL.ADDRECIPIENTBCC ("anyone@mailhost.com");
(ADDRECIPIENTCC) (Email), CC recipient:
such as: JMAIL.ADDRECIPIENTCC ("anyone@mailhost.com")
(addurlattachment) (URL, document name)
Download and add an attachment from the URL. The second parameter, "document name," to specify the name of the file after the letter is received.
such as: Jmail.addurlattachment ("Http://www.chinabs.net/jmail.zip", "JMail")
(appendbodyfromfile) (file name), the file as the body of the letter:
such as: Jmail.appendbodyfromfile ("C:\anyfile.txt")
(AppendText) (Text)
Append the body content of the letter, such as increasing the greeting or other information.
such as: Jmail.appendtext ("Welcome to visit this site!") ” )
Close (), force JMail to turn off buffered connections to the mail server:
such as: Jmail.close ()
Execute () to send the message
such as: Jmail.execute ()

The following code has been debugged in ASP.

<%

Dim nreturnvalue ' send function
Nreturnvalue = Sendmail_jmail ("mail.qcmw.com", "laifangsong#qcmw.com", "Qingcheng WAP Automatic Build Station system", "laifangsong#qcmw.com", " 123456# "," laifangsong#126.com "," Registration success Prompt "," you register successfully on our website! " ")
Select Case Nreturnvalue
Case 0
Response.Write "Mail sent successfully! "
Case 1
Response.Write "Create JMail component failed! "
Case 2
Response.Write "Message sent failed! "
End Select


' JMail send mail (4.4)
' Parameters: Send mail SMTP server, sender email address, sender name, send mail server login, send mail server login password, recipient email address, message title, mail content

Function sendmail_jmail (S_smtpserver, S_frommail, S_fromname, S_mailserverusername, S_mailserverpassword, S_ Toemail, S_subject, S_body)
on Error Resume Next
Set jmail = Server.CreateObject ("JMail. Message ") ' establishes the object to send the mail
If err.number <> 0 Then
Sendmail_jmail = 1
Exit Function
End If

Jmail.silent = True ' Mask exception error, return FALSE and true two value
jmail.logging = False ' Enable mail logging
JMail. Charset = "GB2312" The text encoding of the message is Chinese
JMail. Isoencodeheaders = False ' prevents message headers from garbled
JMail. ContentType = "text/html" The format of the message is HTML format
JMail. Address of AddRecipient s_toemail ' mail Recipient
JMail. from = S_frommail ' e-mail address of sender
JMail. FromName = S_fromname ' sender name
JMail. Mailserverusername = S_mailserverusername ' user name required to log on to the mail server
JMail. Mailserverpassword = S_mailserverpassword ' password required to log on to the mail server
JMail. Subject = S_subject ' The title of the message
JMail. BODY = S_body ' contents of the message
JMail. Priority = 1 ' Mail emergency program, 1 for fastest, 5 for slowest, 3 for default value
JMail. Send (s_smtpserver) ' Perform mail delivery (via mail server address)
JMail. Close () ' Closes object

If JMail. ErrorCode <> 0 Then
Sendmail_jmail = 2
Else
Sendmail_jmail = 0
End If

End Function


' SMTP mail server send component in IIS
Function sendmail_iissmtp (S_frommail, S_toemail, S_subject, S_body)
Set Cdomail = Server.CreateObject ("CDONTS. NewMail ")" Create mail object
Cdomail. Subject = S_subject ' message header
Cdomail. from = S_frommail ' sender's address
Cdomail. to = S_toemail ' recipient's address
Cdomail. BODY = S_body ' contents of the message
Cdomail. Send ' performs sending
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.