. Net uses Jmail to send emails (download instances and Jmail4.3 components) and Jmail parameter descriptions

Source: Internet
Author: User
Configuration environment:. NET Framework 1.1, imai8.02, w3jmail4.3
W3jmail4.3

Jmail reference

Body: String
(V3.0)
Body, body, appendtext
Example: jmail. Body = "Hello World"

Charset: String
(V3.0)
Character Set, "US-ASCII" by default"
Example: JMail. Charset = "US-ASCII"

ContentTransferEncoding: String
(V3.0)
Specifies the encoding method for content transfer. The default value is "Quoted-Printable"
For example, JMail. ContentTransferEncoding = "base64"

ContentType: String
(V3.0)
The contentype of the letter. The default value is "text/plain", but it can be set to another type you want.
If you send an email in HTML format, change it to text/html.
For example, JMail. ContentType = "text/html"

DeferredDelivery: Date
(V3.0)
Set delayed sending. If the email server supports sending, the message will not be sent until this time.
For example: (Javascript) JMail. DeferredDelivery = new Date (2000,
02,17). getVarDate ();

Encoding: String
(V3.0)
This attribute can be used to change the attachment encoding method (base64 by default ).
It uses "base64", "uuencode" or "quoted-printable"
For example, JMail. Encoding = "base64"

ErrorCode: Integer
(V3.0)
If jmail. Silent is set to true, errorcode contains the error code.
For example: Response. Write (jmail. errorcode );

Errormessage: String
(V3.0)
If jmail. Silent is set to true, the error message is contained.
For example: Response. Write (jmail. errormessage );

Errorsource: String
(V3.0)
Contains the error source if jmail. Silent is set to true
For example: Response. Write (jmail. errorsource );

Isoencodeheaders: Boolean
(V3.0)
Whether to encode the header into the iso-8859-1 character set. The default is true
Example: jmail. isoencodeheaders = false

Lazysend: Boolean
(V3.0)
This attribute specifies whether Jmail waits until the mail is sent and then returns, or caches the message and
Send messages in the background.
However, with this attribute set, you cannot control the error message.
Note: If this option is selected, the ServerAddress attribute is invalid, and lazysend uses the dsn
Query determines the email server,
In some settings, this may be a problem.
For example, JMail. LazySend = true;

Log: String
(V3.0)
Logs created by Jmail. If the loging attribute is set to true
For example: Response. Write (JMail. Log );

Logging: Boolean
(V3.0)
Use log?
For example, JMail. Logging = true

MailDomain: String
(V3.0)
This can be used to override the EHLO/HELO statement to your mailserver
For example, JMail. Maildomain = "hello.world.com"

MimeVersion: String
(V3.0)
Specify the mime Version. The default value is 1.0"
Example: JMail. MimeVersion = "1.0"

Priority: Integer
(V3.0)
Priority. Range: 1-5
1. High priority. Some email programs are called urgent
2 is also a high priority
3 normal priority
4. Low priority
5. lowest priority
Example: jmail. Priority = 3

Recipients: String
(V3.0)
Read-only attribute. All recipients are returned.
For example: Response. Write ("" + jmail. Recipients + "");

Replyto: String
(V3.0)
Specify an optional return address
Example: JMail. ReplyTo = "president@dimac.net"

Returnreceept: Boolean
(V3.0)
Specifies whether the sender needs a reply receipt. The default value is false.
For example, JMail. returnreceept = true

Sender: String
(V3.0)
Email address of the sender
Example: JMail. Sender = "batman@dimac.net"

SenderName: String
(V3.0)
Sender name
Example: JMail. SenderName = "Bat man"

ServerAddress: String
(V3.0)
The address of the email server. You can specify multiple servers and use a semicolon to open them. You can specify the port number.
If serverAddress remains blank, JMail will try to solve the remote mail server and then directly
Sent to the server.
For example: JMail. ServerAddress = "mail.mydom.net; mail2.mydom.net: 2500"

Silent: Boolean
(V3.0)
If it is set to true, JMail will not throw an exception error. JMail.exe cute () will be completed according to the operation
Returns true or false.
For example, JMail. silent = true

SimpleLayout: Boolean
(V3.0)
Set to true to reduce the header generated by Jmail.
For example, JMail. SimpleLayout = true

Subject: String
(V3.0)
Set the Message Title
Example: JMail. Subject = "Dimac rocks big time! "

UsePipelining: Boolean
(V3.0)
Overrides if JMail shocould use pipelining on a server that supports it.
Example: JMail. Pipelining = false

AddAttachment (FileName, [ContentType])
(V3.0)
Add file attachment to letter
For example, JMail. AddAttachment ("c: // autoexec. bat ");

AddCustomAttachment (FileName, Data)
(V3.0)
Add custom attachment. This can be used to attach "virtual files" like
A generated text string or certificate etc.
For example, JMail. AddCustomAttachment ("readme.txt", "Contents of file ");

AddHeader (XHeader, Value)
(V3.0)
Add User-Defined X-header to message
For example, JMail. AddHeader ("Originating-IP", "193.15.14.623 ");

AddNativeHeader (Header, Value)
(V3.0)
Add Header
For example, JMail. AddNativeHeader ("MTA-Settings", "route ");

AddRecipient (Email)
(V3.0)
Add recipient
Example: JMail. AddRecipient ("info@dimac.net ");

AddRecipientBCC (Email)
(V3.0)
Add BCC recipients
Example: jmail. addrecipientbcc ("someone@somedomain.net ");

Addrecipientcc (email)
(V3.0)
Add CC recipients
Example: jmail. addrecipientcc ("someone@somedomain.net ");

Addrecipientex (email, name)
(V3.0)
Add a recipient with a name
Example: JMail. AddRecipientEx ("info@dimac.net", "Dimac INFO ");

AddURLAttachment (bstrURL, bstrAttachAs, [bstrAuth])
(V3.0)
Download and add an attachment from the url. The second parameter "AttachAs" is used to specify the letter
The received file name. 3rd optional parameters are used for optional WWW-authentication.
Example: JMail. AddURLAttachment
("Http://download.dimac.net/jmail/jmail.exe", "jmail.exe ")

AppendBodyFromFile (FileName)
(V3.0)
Append the content of a file to the body
For example, JMail. AppendBodyFromFile ("c: // mytext.txt ");

AppendText (Text)
(V3.0)
Body of the appended letter
For example, JMail. AppendText ("Text appended to message Body ");

ClearAttachments ()
(V3.0)
Clear Attachment List
For example, JMail. ClearAttachments ();

ClearCustomHeaders ()
(V3.0)
Clear all custom Headers
For example, JMail. ClearCustomHeaders ();

ClearRecipients ()
(V3.0)
Clear Recipient List
For example, JMail. ClearRecipients ();

Close ()
(V3.0)
Force JMail to disable the buffer connection to the mail server
For example, JMail. Close ();

Execute (): Boolean
(V3.0)
Send the executed email
For example, JMail. Execute ();

ExtractEmailAddressesFromURL (bstrURL, [bstrAuth])
(V3.0)
Download and add email addresses from a url
Example: JMail. ExtractEmailAddressesFromURL
("Http://duplo.org/generateEmailList.asp ");

GetMessageBodyFromURL (bstrURL, [bstrAuth])
(V3.0)
Clear the message body and replace it with the url content. Contenttype is automatically set to UR
L contentyp. The second parameter (login and password) is optional.
Example: JMail. GetMessageBodyFromURL ("http://duplo.org/", "login: password ")

LogCustomMessage (Message)
(V3.0)
Add custom messages to JMail logs. Only when the attribute loging is set to true,
This function works.
For example, JMail. LogCustomMessage ("Hello world ");

Instance:
In the. net project, add reference-> COM to find JMail 4.0 Library (by letter J can be quickly found)
First using jmail;

  1. Public static bool SendMail (string from, string to, string subject, string body)
  2. {
  3. Try
  4. {
  5. Message jmail = new Message ();
  6. Jmail. Charset = "UTF-8 ";
  7. Jmail. From = from;
  8. Jmail. ContentType = "text/html ";
  9. Jmail. AddRecipient (to, null, null );
  10. Jmail. MailServerUserName = "bogoso ";
  11. Jmail. MailServerPassWord = "xz352bgeb ";
  12. Jmail. Subject = subject;
  13. Jmail. HTMLBody = body;
  14. Jmail. Send ("smtp.foxmail.com", false );
  15. }
  16. Catch ()
  17. {
  18. Return false;
  19. }
  20. Return true;
  21. }

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.