本文整理了Java中org.apache.commons.mail.Email.getFromAddress()
方法的一些代码示例,展示了Email.getFromAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Email.getFromAddress()
方法的具体详情如下:
包路径:org.apache.commons.mail.Email
类名称:Email
方法名:getFromAddress
[英]Gets the sender of the email.
[中]获取电子邮件的发件人。
代码示例来源:origin: br.com.caelum.vraptor/vraptor-simplemail
@Override
public void send(Email email) throws EmailException {
logger.info("subject => {}",email.getSubject());
logger.info("from => {}",email.getFromAddress());
logger.info("toAddresses => {}",email.getToAddresses());
if(email instanceof SimpleEmail)
send((SimpleEmail) email);
else if(email instanceof HtmlEmail)
send((HtmlEmail) email);
else
logger.info("body => unknown");
}
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play
public static Email buildMessage(Email email) throws EmailException {
String from = Play.configuration.getProperty("mail.smtp.from");
if (email.getFromAddress() == null && !StringUtils.isEmpty(from)) {
email.setFrom(from);
} else if (email.getFromAddress() == null) {
throw new MailException("Please define a 'from' email address", new NullPointerException());
}
if ((email.getToAddresses() == null || email.getToAddresses().isEmpty())
&& (email.getCcAddresses() == null || email.getCcAddresses().isEmpty())
&& (email.getBccAddresses() == null || email.getBccAddresses().isEmpty())) {
throw new MailException("Please define a recipient email address", new NullPointerException());
}
if (email.getSubject() == null) {
throw new MailException("Please define a subject", new NullPointerException());
}
if (email.getReplyToAddresses() == null || email.getReplyToAddresses().isEmpty()) {
email.addReplyTo(email.getFromAddress().getAddress());
}
return email;
}
代码示例来源: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: com.google.code.maven-play-plugin.org.playframework/play
content.append("\n\tFrom: ").append(email.getFromAddress().getAddress());
content.append("\n\tReplyTo: ").append(email.getReplyToAddresses().get(0).getAddress());
代码示例来源:origin: stackoverflow.com
@Autowired
private MailSender mailSender;
// Email is my own Pojo with from, to, subject and body properties.
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void sendEmail(Email email)
{
// create email message
SimpleMailMessage msg = new SimpleMailMessage();
msg.setFrom(email.getFromAddress());
msg.setTo(email.getToAddress());
msg.setSubject(email.getSubject());
msg.setText(email.getBody());
// send the message using spring mail sender
this.mailSender.send(msg);
}
代码示例来源:origin: org.sonatype.nexus/nexus-core
if (mail.getFromAddress() == null) {
mail.setFrom(configuration.getFromAddress());
代码示例来源:origin: br.com.caelum.vraptor/vraptor-simplemail
public void send(Email email) throws EmailException{
boolean sendForReal = env.has(SEND_REAL_EMAIL) || env.getName().equals("production");
if (sendForReal) {
logger.info("REAL MAIL ::: {} ::: {}", email.getSubject(),
email.getToAddresses());
if (email.getFromAddress() == null) {
email.setFrom(env.get(FROM));
}
if (env.has(REPLY_TO)) {
email.addReplyTo(env.get(REPLY_TO));
}
email.setMailSession(session);
try {
client.sendRawEmail(new SendRawEmailRequest()
.withRawMessage(mail2Content(email)));
} catch (Exception e) {
throw new EmailException(e);
}
} else {
new MockMailer().send(email);
}
}
}
代码示例来源:origin: br.com.caelum.vraptor/vraptor-simplemail
public void send(Email email) throws EmailException{
if (email.getFromAddress() == null) {
email.setFrom(env.get(FROM), env.get(FROM_NAME));
}
email.setHostName(env.get(SERVER));
email.setSmtpPort(Integer.parseInt(env.get(PORT)));
boolean tls = env.supports(TLS);
email.setTLS(tls);
if (tls) {
email.setAuthenticator(new DefaultAuthenticator(env.get(USERNAME),
env.get(PASSWORD)));
}
if(env.has(REPLY_TO)) {
String replyTo = env.get(REPLY_TO);
email.addReplyTo(replyTo);
}
wrapUpAndSend(email);
}
内容来源于网络,如有侵权,请联系作者删除!