Apache Commons Email 怎样设置邮件优先级?

Selier 2012-05-15

Apache Commons Email 怎样设置邮件优先级?

类 org.apache.commons.mail.Email 及其子类

包括    MultiPartEmail, SimpleEmail, HtmlEmail, ImageHtmlEmail

// Email email = Email的实例;
email.addHeader("X-Priority", "1");

也可以把文字带上

// Email email = Email的实例;
email.addHeader("X-Priority", "1 (Highest)");

优先级数值:

1( highest ) or  2( high ) 3( normal ) 4( low ) and 5( lowest )

默认为 "3" 

Values: 1 (Highest), 2 (High), 3 (Normal), 4 (Low), 5 (Lowest). 3 (Normal) is default if the field is omitted.
 

下面是该方法的文档说明:

public void addHeader(String name,
                      String value)


Adds a header ( name, value ) to the headers Map.

 Example:

 X-Mailer: Sendmail, 
 X-Priority: 1( highest ) or  2( high ) 3( normal ) 4( low ) and 5( lowest )
 Disposition-Notification-To: [email protected]

 网上关于邮件优先级的资料:

Email Importance / Priority

http://www.chilkatsoft.com/p/p_471.asp

You can add the X-Priority header field and give it the value string "1″. For example: email.AddHeaderField "X-Priority","1″ This is the most common way of setting the priority of an email. "3″ is normal, and "5″ is the lowest. "2″ and "4″ are in-betweens, and frankly I’ve never seen anything but "1″ or "3″ used. Microsoft Outlook adds these header fields when setting a message to High priority:

X-Priority: 1 (Highest)

X-MSMail-Priority:High

Importance: High

I don’t think you’ll need all three, but you can add them all if you wish. My recommendation is to only add the X-Priority header.

相关推荐

qscool / 0评论 2020-01-24