javax.mail.internet.MimeMessage.getAddressHeader()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中javax.mail.internet.MimeMessage.getAddressHeader()方法的一些代码示例,展示了MimeMessage.getAddressHeader()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeMessage.getAddressHeader()方法的具体详情如下:
包路径:javax.mail.internet.MimeMessage
类名称:MimeMessage
方法名:getAddressHeader

MimeMessage.getAddressHeader介绍

暂无

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

/** 
 * Returns the value of the RFC 822 "From" header fields. If this 
 * header field is absent, the "Sender" header field is used. 
 * If the "Sender" header field is also absent, <code>null</code>
 * is returned.<p>
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @return        Address object
 * @exception    MessagingException for failures
 * @see    #headers
 */
public Address[] getFrom() throws MessagingException {
Address[] a = getAddressHeader("From");
if (a == null)
  a = getAddressHeader("Sender");

return a;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/** 
 * Returns the value of the RFC 822 "Sender" header field.
 * If the "Sender" header field is absent, <code>null</code>
 * is returned.<p>
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @return        Address object
 * @exception    MessagingException for failures
 * @see        #headers
 * @since        JavaMail 1.3
 */
public Address getSender() throws MessagingException {
Address[] a = getAddressHeader("Sender");
if (a == null || a.length == 0)
  return null;
return a[0];	// there can be only one
}

代码示例来源:origin: com.sun.mail/javax.mail

/** 
 * Returns the value of the RFC 822 "Sender" header field.
 * If the "Sender" header field is absent, <code>null</code>
 * is returned.<p>
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @return        Address object
 * @exception    MessagingException for failures
 * @see        #headers
 * @since        JavaMail 1.3
 */
public Address getSender() throws MessagingException {
Address[] a = getAddressHeader("Sender");
if (a == null || a.length == 0)
  return null;
return a[0];	// there can be only one
}

代码示例来源:origin: com.sun.mail/javax.mail

/** 
 * Returns the value of the RFC 822 "From" header fields. If this 
 * header field is absent, the "Sender" header field is used. 
 * If the "Sender" header field is also absent, <code>null</code>
 * is returned.<p>
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @return        Address object
 * @exception    MessagingException for failures
 * @see    #headers
 */
@Override
public Address[] getFrom() throws MessagingException {
Address[] a = getAddressHeader("From");
if (a == null)
  a = getAddressHeader("Sender");

return a;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Return the value of the RFC 822 "Reply-To" header field. If
 * this header is unavailable or its value is absent, then
 * the <code>getFrom</code> method is called and its value is returned.
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @exception    MessagingException for failures
 * @see        #headers
 */
public Address[] getReplyTo() throws MessagingException {
Address[] a = getAddressHeader("Reply-To");
if (a == null || a.length == 0)
  a = getFrom();
return a;
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Return the value of the RFC 822 "Reply-To" header field. If
 * this header is unavailable or its value is absent, then
 * the <code>getFrom</code> method is called and its value is returned.
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @exception    MessagingException for failures
 * @see        #headers
 */
@Override
public Address[] getReplyTo() throws MessagingException {
Address[] a = getAddressHeader("Reply-To");
if (a == null || a.length == 0)
  a = getFrom();
return a;
}

代码示例来源:origin: camunda/camunda-bpm-platform

private void addAddressHeader(String name, Address[] addresses)
    throws MessagingException {
if (addresses == null || addresses.length == 0)
  return;
Address[] a = getAddressHeader(name);
Address[] anew;
if (a == null || a.length == 0)
  anew = addresses;
else {
  anew = new Address[a.length + addresses.length];
  System.arraycopy(a, 0, anew, 0, a.length);
  System.arraycopy(addresses, 0, anew, a.length, addresses.length);
}
String s = InternetAddress.toString(anew, name.length() + 2);
if (s == null)
  return;
setHeader(name, s);
}

代码示例来源:origin: com.sun.mail/javax.mail

private void addAddressHeader(String name, Address[] addresses)
    throws MessagingException {
if (addresses == null || addresses.length == 0)
  return;
Address[] a = getAddressHeader(name);
Address[] anew;
if (a == null || a.length == 0)
  anew = addresses;
else {
  anew = new Address[a.length + addresses.length];
  System.arraycopy(a, 0, anew, 0, a.length);
  System.arraycopy(addresses, 0, anew, a.length, addresses.length);
}
String s;
if (allowutf8)
  s = InternetAddress.toUnicodeString(anew, name.length() + 2);
else
  s = InternetAddress.toString(anew, name.length() + 2);
if (s == null)
  return;
setHeader(name, s);
}

代码示例来源:origin: camunda/camunda-bpm-platform

return (s == null) ? null : NewsAddress.parse(s);
} else
  return getAddressHeader(getHeaderName(type));

代码示例来源:origin: com.sun.mail/javax.mail

return (s == null) ? null : NewsAddress.parse(s);
} else
  return getAddressHeader(getHeaderName(type));

代码示例来源:origin: javax.mail/javax.mail-api

/** 
 * Returns the value of the RFC 822 "Sender" header field.
 * If the "Sender" header field is absent, <code>null</code>
 * is returned.<p>
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @return        Address object
 * @exception    MessagingException for failures
 * @see        #headers
 * @since        JavaMail 1.3
 */
public Address getSender() throws MessagingException {
Address[] a = getAddressHeader("Sender");
if (a == null || a.length == 0)
  return null;
return a[0];	// there can be only one
}

代码示例来源:origin: javax.mail/javax.mail-api

/** 
 * Returns the value of the RFC 822 "From" header fields. If this 
 * header field is absent, the "Sender" header field is used. 
 * If the "Sender" header field is also absent, <code>null</code>
 * is returned.<p>
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @return        Address object
 * @exception    MessagingException for failures
 * @see    #headers
 */
@Override
public Address[] getFrom() throws MessagingException {
Address[] a = getAddressHeader("From");
if (a == null)
  a = getAddressHeader("Sender");

return a;
}

代码示例来源:origin: javax.mail/com.springsource.javax.mail

/** 
 * Returns the value of the RFC 822 "From" header fields. If this 
 * header field is absent, the "Sender" header field is used. 
 * If the "Sender" header field is also absent, <code>null</code>
 * is returned.<p>
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @return        Address object
 * @exception    MessagingException
 * @see    #headers
 */
public Address[] getFrom() throws MessagingException {
Address[] a = getAddressHeader("From");
if (a == null)
  a = getAddressHeader("Sender");

return a;
}

代码示例来源:origin: javax.mail/com.springsource.javax.mail

/**
 * Return the value of the RFC 822 "Reply-To" header field. If
 * this header is unavailable or its value is absent, then
 * the <code>getFrom</code> method is called and its value is returned.
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @exception    MessagingException
 * @see        #headers
 */
public Address[] getReplyTo() throws MessagingException {
Address[] a = getAddressHeader("Reply-To");
if (a == null || a.length == 0)
  a = getFrom();
return a;
}

代码示例来源:origin: javax.mail/javax.mail-api

/**
 * Return the value of the RFC 822 "Reply-To" header field. If
 * this header is unavailable or its value is absent, then
 * the <code>getFrom</code> method is called and its value is returned.
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @exception    MessagingException for failures
 * @see        #headers
 */
@Override
public Address[] getReplyTo() throws MessagingException {
Address[] a = getAddressHeader("Reply-To");
if (a == null || a.length == 0)
  a = getFrom();
return a;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail

/**
 * Return the value of the RFC 822 "Reply-To" header field. If
 * this header is unavailable or its value is absent, then
 * the <code>getFrom</code> method is called and its value is returned.
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @exception    MessagingException
 * @see        #headers
 */
public Address[] getReplyTo() throws MessagingException {
Address[] a = getAddressHeader("Reply-To");
if (a == null)
  a = getFrom();
return a;
}

代码示例来源:origin: com.sun.mail/jakarta.mail

/**
 * Return the value of the RFC 822 "Reply-To" header field. If
 * this header is unavailable or its value is absent, then
 * the <code>getFrom</code> method is called and its value is returned.
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @exception    MessagingException for failures
 * @see        #headers
 */
@Override
public Address[] getReplyTo() throws MessagingException {
Address[] a = getAddressHeader("Reply-To");
if (a == null || a.length == 0)
  a = getFrom();
return a;
}

代码示例来源:origin: com.sun.mail/android-mail

/**
 * Return the value of the RFC 822 "Reply-To" header field. If
 * this header is unavailable or its value is absent, then
 * the <code>getFrom</code> method is called and its value is returned.
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @exception    MessagingException for failures
 * @see        #headers
 */
@Override
public Address[] getReplyTo() throws MessagingException {
Address[] a = getAddressHeader("Reply-To");
if (a == null || a.length == 0)
  a = getFrom();
return a;
}

代码示例来源:origin: com.sun.mail/mailapi

/**
 * Return the value of the RFC 822 "Reply-To" header field. If
 * this header is unavailable or its value is absent, then
 * the <code>getFrom</code> method is called and its value is returned.
 *
 * This implementation uses the <code>getHeader</code> method
 * to obtain the requisite header field.
 *
 * @exception    MessagingException for failures
 * @see        #headers
 */
@Override
public Address[] getReplyTo() throws MessagingException {
Address[] a = getAddressHeader("Reply-To");
if (a == null || a.length == 0)
  a = getFrom();
return a;
}

代码示例来源:origin: javax.mail/com.springsource.javax.mail

private void addAddressHeader(String name, Address[] addresses)
    throws MessagingException {
if (addresses == null || addresses.length == 0)
  return;
Address[] a = getAddressHeader(name);
Address[] anew;
if (a == null || a.length == 0)
  anew = addresses;
else {
  anew = new Address[a.length + addresses.length];
  System.arraycopy(a, 0, anew, 0, a.length);
  System.arraycopy(addresses, 0, anew, a.length, addresses.length);
}
String s = InternetAddress.toString(anew);
if (s == null)
  return;
setHeader(name, s);
}

相关文章

MimeMessage类方法