List of usage examples for javax.mail Message getReplyTo
public Address[] getReplyTo() throws MessagingException
From source file:org.mule.transport.email.MailMuleMessageFactory.java
protected void addReplyToProperty(DefaultMuleMessage muleMessage, Message mailMessage) { try {//from w w w.j a va 2s.co m muleMessage.setInboundProperty(MailProperties.REPLY_TO_ADDRESSES_PROPERTY, MailUtils.mailAddressesToString(mailMessage.getReplyTo())); } catch (MessagingException me) { log.warn("Invalid address found in ReplyTo header:", me); } }
From source file:org.nuxeo.ecm.platform.mail.action.SendMailAction.java
public boolean execute(ExecutionContext context) throws MessagingException { Message message = context.getMessage(); if (log.isDebugEnabled()) { log.debug("Sending mail because of message: " + message.getSubject()); }/* w w w . j ava2 s . c om*/ Message sentMessage = new MimeMessage(session); if (message.getReplyTo() == null || message.getReplyTo().length == 0) { return true; } Address address = message.getReplyTo()[0]; sentMessage.setRecipient(Message.RecipientType.TO, address); message.setText(textMessage); Transport.send(sentMessage); return true; }
From source file:org.springframework.integration.mail.transformer.AbstractMailMessageTransformer.java
private Map<String, Object> extractHeaderMapFromMailMessage(javax.mail.Message mailMessage) { try {//from w ww . j av a 2s. c o m Map<String, Object> headers = new HashMap<String, Object>(); headers.put(MailHeaders.FROM, this.convertToString(mailMessage.getFrom())); headers.put(MailHeaders.BCC, this.convertToStringArray(mailMessage.getRecipients(RecipientType.BCC))); headers.put(MailHeaders.CC, this.convertToStringArray(mailMessage.getRecipients(RecipientType.CC))); headers.put(MailHeaders.TO, this.convertToStringArray(mailMessage.getRecipients(RecipientType.TO))); headers.put(MailHeaders.REPLY_TO, this.convertToString(mailMessage.getReplyTo())); headers.put(MailHeaders.SUBJECT, mailMessage.getSubject()); return headers; } catch (Exception e) { throw new MessagingException("conversion of MailMessage headers failed", e); } }