Package org.apache.commons.mail

Examples of org.apache.commons.mail.SimpleEmail.addTo()


    email.setMailSession(session);
    email.setFrom(from, fromDisplayName);
    email.setSubject(subject);
    email.setCharset("UTF-8");
    email.setMsg(content);
    email.addTo(addr, displayName);

    email.send();
      } catch (Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e.getMessage());
View Full Code Here


         getDateInstance(SimpleDateFormat.LONG).
         format(lastModified)
           });

      email.setMailSession(session);
      email.addTo(to, toDisplayName);
      email.setFrom(from, fromDisplayName);
      email.setSubject(subject);
      email.setCharset("UTF-8");
      email.setMsg(content);
View Full Code Here

        SimpleEmail email = new SimpleEmail();

        Map<String, String[]> formData = request().body().asFormUrlEncoded();
        email.setFrom(utils.HttpUtil.getFirstValueFromQuery(formData, "from"));
        email.setSubject(utils.HttpUtil.getFirstValueFromQuery(formData, "subject"));
        email.addTo(utils.HttpUtil.getFirstValueFromQuery(formData, "to"));
        email.setMsg(utils.HttpUtil.getFirstValueFromQuery(formData, "body"));
        email.setCharset("utf-8");

        String errorMessage = null;
        boolean sended;
View Full Code Here

    public void testSendSimpleMail() throws Exception {
        //Given
        SimpleEmail email = new SimpleEmail();
        email.setFrom(SENDER_LOCALHOST);
        email.setSubject(SUBJECT);
        email.addTo(RECIPIENT_LOCALHOST);
        email.setMsg(DEFAULT_TEXT_MESSAGE);
        email.setCharset("utf-8");

        //When
        Mailer.send(email);
View Full Code Here

  private SimpleEmail createEmailFor(String msg, Throwable e)
      throws EmailException {
    SimpleEmail email = new SimpleEmail();
    String mailingList = env.get(TARGET_MAILING_LIST);
    email.addTo(mailingList);
    email.setSubject("production error");
    email.setMsg(msg + "\nException: \n" + stackAsString(e));
    String from = env.get("vraptor.simplemail.main.from");
    String fromName = env.get("vraptor.simplemail.main.from.name");
    email.setFrom(from, fromName);
View Full Code Here

  }

  @Test(expected = MailException.class)
  public void buildMessageWithoutFrom() throws EmailException {
    Email emailWithoutFrom = new SimpleEmail();
    emailWithoutFrom.addTo("from@playframework.com");
    emailWithoutFrom.setSubject("subject");
    Mail.buildMessage(new SimpleEmail());
  }

  @Test(expected = MailException.class)
View Full Code Here

  @Test(expected = MailException.class)
  public void buildMessageWithoutSubject() throws EmailException {
    Email emailWithoutSubject = new SimpleEmail();
    emailWithoutSubject.setFrom("from@playframework.com");
    emailWithoutSubject.addTo("to@playframework.com");
    Mail.buildMessage(emailWithoutSubject);
  }

  @Test
  public void buildValidMessages() throws EmailException {
View Full Code Here

      }
      // Set general information
      email.setCharset("UTF-8");
      String from = StringUtils.isBlank(emailMessage.getFrom()) ? FROM_NAME_DEFAULT : emailMessage.getFrom() + " (SonarQube)";
      email.setFrom(configuration.getFrom(), from);
      email.addTo(emailMessage.getTo(), " ");
      String subject = StringUtils.defaultIfBlank(StringUtils.trimToEmpty(configuration.getPrefix()) + " ", "")
        + StringUtils.defaultString(emailMessage.getSubject(), SUBJECT_DEFAULT);
      email.setSubject(subject);
      email.setMsg(emailMessage.getMessage());
      // Send
View Full Code Here

    @Test(expected = MailException.class)
    public void buildMessageWithoutFrom() throws EmailException {
        new YalpBuilder().build();

        Email email = new SimpleEmail();
        email.addTo("from@yalpframework.com");
        email.setSubject("subject");
        Mail.buildMessage(new SimpleEmail());
    }

    @Test(expected = MailException.class)
View Full Code Here

    public void buildMessageWithoutSubject() throws EmailException {
        new YalpBuilder().build();

        Email email = new SimpleEmail();
        email.setFrom("from@yalpframework.com");
        email.addTo("to@yalpframework.com");
        Mail.buildMessage(email);
    }

    @Test
    public void buildValidMessages() throws EmailException {
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.