org.apache.commons.mail.Email.getHostName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(89)

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

Email.getHostName介绍

[英]Gets the host name of the SMTP server,
[中]获取SMTP服务器的主机名,

代码示例

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

/**
 * Sends the previously created MimeMessage to the SMTP server.
 *
 * @return the message id of the underlying MimeMessage
 * @throws IllegalArgumentException if the MimeMessage has not been created
 * @throws EmailException the sending failed
 */
public String sendMimeMessage()
  throws EmailException
{
  EmailUtils.notNull(this.message, "MimeMessage has not been created yet");
  try
  {
    Transport.send(this.message);
    return this.message.getMessageID();
  }
  catch (final Throwable t)
  {
    final String msg = "Sending the email to the following server failed : "
      + this.getHostName()
      + ":"
      + this.getSmtpPort();
    throw new EmailException(msg, t);
  }
}

代码示例来源:origin: br.com.caelum.vraptor/vraptor-simplemail

protected void wrapUpAndSend(Email email) throws EmailException {
  LOGGER.debug(String.format(emailLogTemplate(),
      email.getSubject(),
      email.getFromAddress(),
      email.getToAddresses(),
      email.getHostName(),
      email.getSmtpPort(),
      email.isTLS()));
  email.send();
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Sends the previously created MimeMessage to the SMTP server.
 *
 * @return the message id of the underlying MimeMessage
 * @throws IllegalArgumentException if the MimeMessage has not been created
 * @throws EmailException the sending failed
 */
public String sendMimeMessage()
  throws EmailException
{
  EmailUtils.notNull(this.message, "MimeMessage has not been created yet");
  try
  {
    Transport.send(this.message);
    return this.message.getMessageID();
  }
  catch (final Throwable t)
  {
    final String msg = "Sending the email to the following server failed : "
      + this.getHostName()
      + ":"
      + this.getSmtpPort();
    throw new EmailException(msg, t);
  }
}

相关文章

微信公众号

最新文章

更多