Package org.springframework.mail.javamail

Examples of org.springframework.mail.javamail.JavaMailSender.send()


    mail.setFrom(mail.getFrom());
    mail.setTo(eMail);
    mail.setSubject(mail.getSubject());
    mail.setText("�˺ţ�" + userName + "\n" + "���룺" + passWord);
    try {
      sender.send(mail);
    } catch (MailException e) {
      throw new MyMailException("Mail timeout!");
    }
  }
View Full Code Here


    Map data = new HashMap();
    data.put("msg", "Hello World!");

    preparator.setData(data);

    sender.send(preparator);
  }
}
View Full Code Here

      }
      if(bodyText!=null){
        helper.setText(bodyText, false);
      }
     
      emailSender.send(mimeMessage);
     
    }catch(MessagingException e){
      //TODO: do something
      e.printStackTrace();
    }
View Full Code Here

            for (Map.Entry<String, InputStreamSource> entry : mailDto
                    .getAttachments().entrySet()) {
                helper.addAttachment(entry.getKey(), entry.getValue());
            }

            javaMailSender.send(msg);
            logger.debug("send mail from {} to {}", from, to);
            mailDto.setSuccess(true);
        } catch (Exception e) {
            logger.error("send mail error", e);
            mailDto.setSuccess(false);
View Full Code Here

             message.setText(text, true);
             _log.info("Sending email to ["+mailMessage.getMsgTo()+"] with subject ["+mailMessage.getSubject()+"].");
          }
       };
       //send the mail message...
       mailSender.send(preparator);
  }
}
View Full Code Here

      }

    };

    try {
      ms.send(preparator);
    } catch (MailException e) {
      throw new IllegalStateException(e);
    }

    System.out.println(String.format("The email to '%s' was sent successfully.", toEmailAddress));
View Full Code Here

                helper.addTo(s);
            }
            helper.setFrom(configuration.getSenderEmail(), configuration.getSenderName());
            helper.setSubject(notificationStep.getSubject());
            helper.setText(((NotificationAction) getAction()).getMessage());
            sender.send(mimeMessage);
            return new NotificationResult(getAction());
        } catch (MailSendException e) {
            log.error(e.getMessage(), e);
            return new NotificationResultFailed(getAction(), (e.getMessageExceptions() != null && e.getMessageExceptions().length > 0) ? e.getMessageExceptions()[0] : e);
        } catch (Throwable e) {
View Full Code Here

                helper.addTo(s);
            }
            helper.setFrom(configuration.getSenderEmail(), configuration.getSenderName());
            helper.setSubject(subject);
            helper.setText(message);
            sender.send(mimeMessage);
        } catch (MessagingException e) {
            throw new RuntimeException("Failed to create message", e);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("Failed to create message", e);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.