@Override public void send(MimeMessagePreparator... mimeMessagePreparators) throws MailException { try { List<MimeMessage> mimeMessages = new ArrayList<>(mimeMessagePreparators.length); for (MimeMessagePreparator preparator : mimeMessagePreparators) { MimeMessage mimeMessage = createMimeMessage(); preparator.prepare(mimeMessage); mimeMessages.add(mimeMessage); } send(mimeMessages.toArray(new MimeMessage[0])); } catch (MailException ex) { throw ex; } catch (MessagingException ex) { throw new MailParseException(ex); } catch (Exception ex) { throw new MailPreparationException(ex); } }
@Override public void send(MimeMessagePreparator... mimeMessagePreparators) throws MailException { try { List<MimeMessage> mimeMessages = new ArrayList<>(mimeMessagePreparators.length); for (MimeMessagePreparator preparator : mimeMessagePreparators) { MimeMessage mimeMessage = createMimeMessage(); preparator.prepare(mimeMessage); mimeMessages.add(mimeMessage); } send(mimeMessages.toArray(new MimeMessage[0])); } catch (MailException ex) { throw ex; } catch (MessagingException ex) { throw new MailParseException(ex); } catch (Exception ex) { throw new MailPreparationException(ex); } }
textTemplate.process(templateTokens, textWriter); } catch (TemplateException e) { throw new MailPreparationException( "Can't generate text mail", e); htmlTemplate.process(templateTokens, htmlWriter); } catch (TemplateException e) { throw new MailPreparationException( "Can't generate HTML mail", e);
public void send(String fromAddr, String fromPersonal, String toAddr, String subject, EmailContent content) { try { send(new InternetAddress(fromAddr, fromPersonal), new InternetAddress[] { new InternetAddress(toAddr) }, null, null, subject, content); } catch (AddressException e) { throw new MailPreparationException(e); } catch (UnsupportedEncodingException e) { throw new MailPreparationException(e); } }
public void send(String fromAddr, String fromPersonal, String[] toAddr, String subject, EmailContent content) { try { InternetAddress[] toIAddr = new InternetAddress[toAddr.length]; for (int i = 0; i < toAddr.length; i++) toIAddr[i] = new InternetAddress(toAddr[i]); send(new InternetAddress(fromAddr, fromPersonal), toIAddr, null, null, subject, content); } catch (AddressException e) { throw new MailPreparationException(e); } catch (UnsupportedEncodingException e) { throw new MailPreparationException(e); } }
public void send(InternetAddress from, String toAddr, String subject, EmailContent content) { try { send(from, new InternetAddress[] { new InternetAddress(toAddr) }, null, null, subject, content); } catch (AddressException e) { throw new MailPreparationException(e); } }
@Override public void send(MimeMessage mimeMessage) throws MailException { try { final String content = (String) mimeMessage.getContent(); log.info("Mail Message: " + content); } catch (final Exception e) { throw new MailPreparationException(e); } }
public void send(InternetAddress from, String toAddr[], String subject, EmailContent content) { try { InternetAddress[] toIAddr = new InternetAddress[toAddr.length]; for (int i = 0; i < toAddr.length; i++) toIAddr[i] = new InternetAddress(toAddr[i]); send(from, toIAddr, null, null, subject, content); } catch (AddressException e) { throw new MailPreparationException(e); } }
private RawMessage createRawMessage(MimeMessage mimeMessage) { ByteArrayOutputStream out; try { out = new ByteArrayOutputStream(); mimeMessage.writeTo(out); } catch (IOException e) { throw new MailPreparationException(e); } catch (MessagingException e) { throw new MailParseException(e); } return new RawMessage(ByteBuffer.wrap(out.toByteArray())); } }
private RawMessage createRawMessage(MimeMessage mimeMessage) { ByteArrayOutputStream out; try { out = new ByteArrayOutputStream(); mimeMessage.writeTo(out); } catch (IOException e) { throw new MailPreparationException(e); } catch (MessagingException e) { throw new MailParseException(e); } return new RawMessage(ByteBuffer.wrap(out.toByteArray())); } }
@Override public void send(final MimeMessagePreparator mimeMessagePreparator) throws MailException { final MimeMessage mimeMessage = createMimeMessage(); try { mimeMessagePreparator.prepare(mimeMessage); final String content = (String) mimeMessage.getContent(); log.info("Mail Message: " + content); } catch (final Exception e) { throw new MailPreparationException(e); } }
@Override public void send(final MimeMessagePreparator mimeMessagePreparator) throws MailException { final MimeMessage mimeMessage = createMimeMessage(); try { mimeMessagePreparator.prepare(mimeMessage); final String content = (String) mimeMessage.getContent(); log.info("Mail Message: " + content); } catch (final Exception e) { throw new MailPreparationException(e); } }
@Override public void send(MimeMessage mimeMessage) throws MailException { try { String content = (String) mimeMessage.getContent(); String subject = mimeMessage.getSubject(); Address[] recipients = mimeMessage.getRecipients(RecipientType.TO); StringBuffer toSb = new StringBuffer(); for (Address recipient : recipients) { toSb.append(recipient.toString()); toSb.append(","); } if (toSb.length() > 1) { toSb.setLength(toSb.length() - 1); } postMailMessage(content, subject, toSb.toString()); } catch (final Exception e) { throw new MailPreparationException(e); } }
@SuppressWarnings("OverloadedVarargsMethod") @Override public void send(MimeMessagePreparator... mimeMessagePreparators) throws MailException { MimeMessage mimeMessage = createMimeMessage(); for (MimeMessagePreparator mimeMessagePreparator : mimeMessagePreparators) { try { mimeMessagePreparator.prepare(mimeMessage); } catch (Exception e) { throw new MailPreparationException(e); } } send(mimeMessage); }
@SuppressWarnings("OverloadedVarargsMethod") @Override public void send(MimeMessagePreparator... mimeMessagePreparators) throws MailException { MimeMessage mimeMessage = createMimeMessage(); for (MimeMessagePreparator mimeMessagePreparator : mimeMessagePreparators) { try { mimeMessagePreparator.prepare(mimeMessage); } catch (Exception e) { throw new MailPreparationException(e); } } send(mimeMessage); }
@Override public void send(MimeMessagePreparator... mimeMessagePreparators) throws MailException { try { List<MimeMessage> mimeMessages = new ArrayList<MimeMessage>(mimeMessagePreparators.length); for (MimeMessagePreparator preparator : mimeMessagePreparators) { MimeMessage mimeMessage = createMimeMessage(); preparator.prepare(mimeMessage); mimeMessages.add(mimeMessage); } send(mimeMessages.toArray(new MimeMessage[mimeMessages.size()])); } catch (MailException ex) { throw ex; } catch (MessagingException ex) { throw new MailParseException(ex); } catch (Exception ex) { throw new MailPreparationException(ex); } }
throw new MailPreparationException( "All recipients for the mail action were invalid" ); throw new MailPreparationException( "No recipient has been specified for the mail action" );
throw new MailPreparationException( "All recipients for the mail action were invalid" ); throw new MailPreparationException( "No recipient has been specified for the mail action" );
throw new MailPreparationException( "All recipients for the mail action were invalid" ); throw new MailPreparationException( "No recipient has been specified for the mail action" );
throw new MailPreparationException( "All recipients for the mail action were invalid" ); throw new MailPreparationException( "No recipient has been specified for the mail action" );