Examples of SimpleEmail


Examples of org.apache.commons.mail.SimpleEmail

    }
  }

  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);
    return email;
  }
View Full Code Here

Examples of org.apache.commons.mail.SimpleEmail

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

    Email email = new SimpleEmail();
    email.addTo("from@playframework.org");
    email.setSubject("subject");
    Mail.buildMessage(new SimpleEmail());
  }
View Full Code Here

Examples of org.apache.commons.mail.SimpleEmail

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

    Email email = new SimpleEmail();
    email.setFrom("from@playframework.org");
    email.setSubject("subject");
    Mail.buildMessage(email);
  }
View Full Code Here

Examples of org.apache.commons.mail.SimpleEmail

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

    Email email = new SimpleEmail();
    email.setFrom("from@playframework.org");
    email.addTo("to@playframework.org");
    Mail.buildMessage(email);
  }
View Full Code Here

Examples of org.apache.commons.mail.SimpleEmail

  @Test
  public void buildValidMessages() throws EmailException {
    new PlayBuilder().build();

    Email email = new SimpleEmail();
    email.setFrom("from@playframework.org");
    email.addTo("to@playframework.org");
    email.setSubject("subject");
    Mail.buildMessage(email);

    email = new SimpleEmail();
    email.setFrom("from@playframework.org");
    email.addCc("to@playframework.org");
    email.setSubject("subject");
    Mail.buildMessage(email);

    email = new SimpleEmail();
    email.setFrom("from@playframework.org");
    email.addBcc("to@playframework.org");
    email.setSubject("subject");
    Mail.buildMessage(email);
  }
View Full Code Here

Examples of org.apache.commons.mail.SimpleEmail

   *
   * @param mailInfo
   *            待发送的邮件的信息
   */
  public static boolean sendTextMail(MailSenderInfo mailInfo) {
    SimpleEmail email = new SimpleEmail();
    try {

      email.setHostName(mailInfo.getHostName()); // 设定smtp服务器
      email.setSSL(mailInfo.getIsSSL()); // 设定是否使用SSL
      email.setSslSmtpPort(mailInfo.getSslSmtpPort()); // 设定SSL端口
      email.setAuthentication(mailInfo.getUserName(), mailInfo
          .getPassword()); // 设定smtp服务器的认证资料信息
      email.setDebug(mailInfo.getIsDebug()); // 是否用debug模式
      email.addTo(mailInfo.getToAddress(), mailInfo.getToName()); // 设定收件人
      email.setFrom(mailInfo.getFromAddress(), mailInfo.getFromName());
      email.setSubject(mailInfo.getSubject());
      email.setCharset(mailInfo.getCharset());// 设定内容的语言集
      email.setMsg(mailInfo.getContent());// 设定邮件内容
      email.send();// 发送邮件
      return true;
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return false;
View Full Code Here

Examples of org.apache.turbine.util.mail.SimpleEmail

        try
        {
            // Process the template.
            String body = TurbineWebMacro.handleRequest(context,template);

            SimpleEmail se = new SimpleEmail();
            se.setFrom(fromEmail, fromName);
            se.addTo(toEmail, toName);
            se.setSubject(subject);
            se.setMsg(body);
            se.send();
        }
        catch (Exception e)
        {
            // Log the error.
            Log.error ("WebMacroEmail error: ", e);
View Full Code Here

Examples of org.apache.turbine.util.mail.SimpleEmail

            body = StringUtils.wrapText (body,
                                         System.getProperty("line.separator"),
                                         wordWrap);
        }

        SimpleEmail se = new SimpleEmail();
        se.setFrom(fromEmail, fromName);
        se.addTo(toEmail, toName);
        se.setSubject(subject);
        se.setMsg(body);
        se.send();
    }
View Full Code Here

Examples of org.apache.turbine.util.mail.SimpleEmail

                             .addQueryData("mode","update");
        try
        {
            //build body via template
            StringWriter email_body = new StringWriter();
            SimpleEmail se = new SimpleEmail();
            Context emailContext = TurbineVelocity.getContext();
            emailContext.put( "data", data );
            emailContext.put( "user", user );
            emailContext.put( "config",new JetspeedResources());
            emailContext.put( "userurl",url);
            emailContext.put( "email",se);

            //determine the language to be used for the notification email
            String language = JetspeedResources.getString("newuser.notification.language","en");
            String country = JetspeedResources.getString("newuser.notification.country","US");
            Locale locale = new Locale(language,country);

            String templateFile = JetspeedResources.getString("newuser.notification.email.template");
            String templatePath = TemplateLocator.locateEmailTemplate(data, templateFile, locale);
            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);

            se.setMsg(email_body.toString());

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put ( "mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

            data.setMessage (CustomLocalization.getString("SENDCONFIRMATIONEMAIL_SENT", data));
        } catch ( Exception e )
        {
            String errorTitle = CustomLocalization.getString("SENDCONFIRMATIONEMAIL_ERROR", data) ;
View Full Code Here

Examples of org.apache.turbine.util.mail.SimpleEmail

                loc = new Locale(lang,ctry);
            }

            String templatePath = TemplateLocator.locateEmailTemplate(data, JetspeedResources.getString("password.reminder.template"), loc);

            SimpleEmail se = new SimpleEmail();

            context.put("email",se);

            TurbineVelocity.handleRequest(context, templatePath, email_body);

            se.setMsg(email_body.toString());

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put("mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

            data.setMessage (CustomLocalization.getString("JLOGINUSER_PASSWORDREMINDER_SENT", rundata));
            logger.info( "Password for user " + user.getUserName() + " was sent to " + user.getEmail());
            logger.info(CustomLocalization.getString("JLOGINUSER_PASSWORDREMINDER_SENT", rundata));
            data.setScreenTemplate("Login");
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.