本文整理了Java中org.apache.commons.mail.Email.getHostName()
方法的一些代码示例,展示了Email.getHostName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Email.getHostName()
方法的具体详情如下:
包路径:org.apache.commons.mail.Email
类名称: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!