Package org.springframework.mail

Examples of org.springframework.mail.SimpleMailMessage


    SimpleMailMessage msg = createSimpleMessage(toAddress, title, content);
    SENDER.send(msg);
  }

  public static void sendSimpleMail(String[] toAddresses, String title, String content) {
    SimpleMailMessage msg = createSimpleMessage(toAddresses, null, null, null, title, content);
    SENDER.send(msg);
  }
View Full Code Here


     * @param text
     * @throws AdministrationEmailException
     */
    public void sendEmail(String from, String subject, String to, String text) throws AdministrationEmailException
    {
        SimpleMailMessage msg = new SimpleMailMessage();
        if(from == null)
        {
            from = "jetspeed-admin@apache.org";
        }
        msg.setFrom(from);
        if(subject == null)
        {
            subject = "message from jetspeed";
        }
        msg.setSubject(subject);
        msg.setTo(to);
        msg.setText(text);
        try
        {
            mailSender.send(msg);
        }
        catch (MailException ex)
View Full Code Here

     * @param text
     * @throws AdministrationEmailException
     */
    public void sendEmail(String from, String subject, String to, String text) throws AdministrationEmailException
    {
        SimpleMailMessage msg = new SimpleMailMessage();
        if(from == null)
        {
            from = "jetspeed-admin@apache.org";
        }
        msg.setFrom(from);
        if(subject == null)
        {
            subject = "message from jetspeed";
        }
        msg.setSubject(subject);
        msg.setTo(to);
        msg.setText(text);
        try
        {
            mailSender.send(msg);
        }
        catch (MailException ex)
View Full Code Here

    String text3=messageSource.getMessage("data.inizio", null,local);
    String text4=messageSource.getMessage("data.fine", null,local);
    String header=messageSource.getMessage("mailIntestazione", null,local);

    //messageSource.getMe
    SimpleMailMessage msg = new SimpleMailMessage();
    String beginDate = CalendarUtils.GetDateAsString(booking.getBeginDate());
    String finishDate = CalendarUtils.GetDateAsString(booking.getFinishDate());
    msg.setText(text1  + booking.getCustomer().getName() + " " + booking.getCustomer().getSurname()+" " +text2+" "+booking.getRoom().getTypology().getName()+" "+ text3+" " + beginDate+" "+ text4+" "+finishDate);
    msg.setTo(booking.getStructure().getMail());
    msg.setFrom("labos@labos.com");
    msg.setSubject(header+" " + booking.getStructure().getName());

      sendMail(msg);

   
  }
View Full Code Here

      String text1=messageSource.getMessage("mailCustomer", null,local);
      String text2=messageSource.getMessage("mailCustomer1", null,local);
      String text3=messageSource.getMessage("data.inizio", null,local);
      String text4=messageSource.getMessage("data.fine", null,local);
      String header=messageSource.getMessage("mailIntestazione", null,local);
      SimpleMailMessage msg = new SimpleMailMessage();
      String beginDate = CalendarUtils.GetDateAsString(booking.getBeginDate());
      String finishDate = CalendarUtils.GetDateAsString(booking.getFinishDate());
      msg.setText(text1  +" "+ booking.getStructure().getName()+" " +text2+" "+booking.getRoom().getTypology().getName()+" "+ text3+" " + beginDate+" "+ text4+" "+finishDate);
      msg.setTo(booking.getCustomer().getMail());
      msg.setFrom("labos@labos.com");
      msg.setSubject(header+" " + booking.getStructure().getName());
      sendMail(msg);
     
   
  }
View Full Code Here

      String text2=messageSource.getMessage("mailCustomer2", null,local);
      String text3=messageSource.getMessage("data.inizio", null,local);
      String text4=messageSource.getMessage("data.fine", null,local);
      String text5=messageSource.getMessage("mailCustomer3", null,local);
      String header=messageSource.getMessage("mailIntestazione", null,local);
      SimpleMailMessage msg = new SimpleMailMessage();
      String beginDate = CalendarUtils.GetDateAsString(booking.getBeginDate());
      String finishDate = CalendarUtils.GetDateAsString(booking.getFinishDate());
      msg.setText(text1 +" "+ booking.getStructure().getName()+" " +text2+" "+booking.getRoom().getTypology().getName()+" "+ text3+" " + beginDate+" "+ text4+" "+finishDate+ " "+text5);
      msg.setTo(booking.getCustomer().getMail());
      msg.setFrom("labos@labos.com");
      msg.setSubject(header+" " + booking.getStructure().getName());
      sendMail(msg);

     
  }
View Full Code Here

      String text2=messageSource.getMessage("mailCustomer4", null,local);
      String text3=messageSource.getMessage("data.inizio", null,local);
      String text4=messageSource.getMessage("data.fine", null,local);
      String text5=messageSource.getMessage("mailCustomer5", null,local);
      String header=messageSource.getMessage("mailIntestazione", null,local);
      SimpleMailMessage msg = new SimpleMailMessage();
      String beginDate = CalendarUtils.GetDateAsString(booking.getBeginDate());
      String finishDate = CalendarUtils.GetDateAsString(booking.getFinishDate());
      msg.setText(text1  +" "+ booking.getStructure().getName()+" " +text2+" "+booking.getRoom().getTypology().getName()+" "+ text3+" " + beginDate+" "+ text4+" "+finishDate+ " "+text5+ " "+ booking.getStructure().getName());
      msg.setTo(booking.getCustomer().getMail());
      msg.setFrom("labos@labos.com");
      msg.setSubject(header+" " + booking.getStructure().getName());
      sendMail(msg);
    }
View Full Code Here

      String text3=messageSource.getMessage("data.inizio", null,local);
      String text4=messageSource.getMessage("data.fine", null,local);
      String header=messageSource.getMessage("mailIntestazione", null,local);

      //messageSource.getMe
      SimpleMailMessage msg = new SimpleMailMessage();
      String beginDate = CalendarUtils.GetDateAsString(booking.getBeginDate());
      String finishDate = CalendarUtils.GetDateAsString(booking.getFinishDate());
      msg.setText(text1  + booking.getCustomer().getName() + " " + booking.getCustomer().getSurname()+" " +text2+" "+booking.getRoom().getTypology().getName()+" "+ text3+" " + beginDate+" "+ text4+" "+finishDate);
      msg.setTo(booking.getStructure().getMail());
      msg.setFrom("labos@labos.com");
      msg.setSubject(header+" " + booking.getStructure().getName());
     
      sendMail(msg);
 
     
    }
View Full Code Here

        JavaMailSenderImpl sender = new JavaMailSenderImpl();
        sender.setHost(NetworkAddressUtil.LOOPBACK_ADDRESS);
        sender.setProtocol(JavaMailSenderImpl.DEFAULT_PROTOCOL);
        sender.setPort(port);

        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("from@com.springsource.insight.plugin.mail");
        message.setTo("to@com.springsource.insight.plugin.mail");
        message.setCc("cc@com.springsource.insight.plugin.mail");
        message.setBcc("bcc@com.springsource.insight.plugin.mail");

        Date now = new Date(System.currentTimeMillis());
        message.setSentDate(now);
        message.setSubject(now.toString());
        message.setText("Test at " + now.toString());
        sender.send(message);

        Operation op = getLastEntered();
        assertNotNull("No operation extracted", op);
        assertEquals("Mismatched operation type", MailDefinitions.SEND_OPERATION, op.getType());
        assertEquals("Mismatched protocol", sender.getProtocol(), op.get(MailDefinitions.SEND_PROTOCOL, String.class));
        assertEquals("Mismatched host", sender.getHost(), op.get(MailDefinitions.SEND_HOST, String.class));
        if (port == -1) {
            assertEquals("Mismatched default port", 25, op.getInt(MailDefinitions.SEND_PORT, (-1)));
        } else {
            assertEquals("Mismatched send port", sender.getPort(), op.getInt(MailDefinitions.SEND_PORT, (-1)));
        }

        if (getAspect().collectExtraInformation()) {
            assertAddresses(op, MailDefinitions.SEND_SENDERS, 1);
            assertAddresses(op, MailDefinitions.SEND_RECIPS, 3);

            OperationMap details = op.get(MailDefinitions.SEND_DETAILS, OperationMap.class);
            assertNotNull("No details extracted", details);
            assertEquals("Mismatched subject", message.getSubject(), details.get(MailDefinitions.SEND_SUBJECT, String.class));
        }
    }
View Full Code Here

        sender = new TestJavaMailSender();
    }

    @Test
    public void testSendSimpleMessageInstance() throws Exception {
        SimpleMailMessage msg = createSimpleMailMessage("testSendSimpleMessageInstance", "from@a", "to@a", "cc@a", "bcc@a", "replyTo@a");
        sender.send(msg);
        assertSendOperation(msg);
    }
View Full Code Here

TOP

Related Classes of org.springframework.mail.SimpleMailMessage

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.