Package org.springframework.mail.javamail

Examples of org.springframework.mail.javamail.JavaMailSender


    public MailEndpoint(String endpointUri) {
        this(endpointUri, new MailConfiguration());
    }

    public Producer<MailExchange> createProducer() throws Exception {
        JavaMailSender sender = configuration.createJavaMailSender();
        return createProducer(sender);
    }
View Full Code Here


  @Override
  public void sendMail(String eMail, String userName, String passWord)
      throws MailException {
    b.B();
    JavaMailSender sender = (JavaMailSender) mailSender; // �����˴������ļ��ж�ȡ
    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

    public MailEndpoint(String endpointUri) {
        this(endpointUri, new MailConfiguration());
    }

    public Producer<MailExchange> createProducer() throws Exception {
        JavaMailSender sender = configuration.createJavaMailSender();
        return createProducer(sender);
    }
View Full Code Here

        super(uri, component);
        this.configuration = configuration;
    }

    public Producer<MailExchange> createProducer() throws Exception {
        JavaMailSender sender = configuration.createJavaMailConnection(this);
        return createProducer(sender);
    }
View Full Code Here

  public static void main(String[] args) {
    ApplicationContext ctx = new FileSystemXmlApplicationContext(
        new String[] { "./ch15/src/conf/velocity.xml",
            "./ch15/src/conf/javaMailSender.xml" });

    JavaMailSender sender = (JavaMailSender) ctx.getBean("sender");
    VelocityMimeMessagePreparator preparator = (VelocityMimeMessagePreparator) ctx
        .getBean("preparator");

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

    preparator.setData(data);

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

        super(uri, component);
        this.configuration = configuration;
    }

    public Producer<MailExchange> createProducer() throws Exception {
        JavaMailSender sender = configuration.createJavaMailConnection(this);
        return createProducer(sender);
    }
View Full Code Here

    public MailEndpoint(String endpointUri) {
        this(endpointUri, new MailConfiguration());
    }

    public Producer createProducer() throws Exception {
        JavaMailSender sender = configuration.getJavaMailSender();
        if (sender == null) {
            // use default mail sender
            sender = configuration.createJavaMailSender();
        }
        return createProducer(sender);
View Full Code Here

    public MailEndpoint(String endpointUri) {
        this(endpointUri, new MailConfiguration());
    }

    public Producer createProducer() throws Exception {
        JavaMailSender sender = configuration.getJavaMailSender();
        if (sender == null) {
            // use default mail sender
            sender = configuration.createJavaMailSender();
        }
        return createProducer(sender);
View Full Code Here

        super(uri, component);
        this.configuration = configuration;
    }

    public Producer<MailExchange> createProducer() throws Exception {
        JavaMailSender sender = configuration.createJavaMailConnection(this);
        return createProducer(sender);
    }
View Full Code Here

   
    if(senderName!=null){
      from = senderName+" <"+from+">";
    }
   
    JavaMailSender emailSender = createJavaMailSender(email.getStoreId());
   
    MimeMessage mimeMessage = emailSender.createMimeMessage();
    MimeMessageHelper helper = new MimeMessageHelper(mimeMessage);
    try{
      helper.setFrom(from);
      helper.setTo(to);
      helper.setSubject(subject);
      if(bodyHtml!=null){
        helper.setText(bodyHtml, true);
      }
      if(bodyText!=null){
        helper.setText(bodyText, false);
      }
     
      emailSender.send(mimeMessage);
     
    }catch(MessagingException e){
      //TODO: do something
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of org.springframework.mail.javamail.JavaMailSender

Copyright © 2018 www.massapicom. 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.