Package org.apache.commons.mail

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


    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());
    // embed the image and get the content id
    File file = new File(mailInfo.getFilePath());
    String cid = email.embed(file);
View Full Code Here


      if (PasswordRecovery.NETWORK_SMTP_AUTHENTICATION.getValueAsBoolean()) {
        email.setAuthenticator(new  DefaultAuthenticator(username_smtp, password_smtp));
      }
      email.setFrom(emailFrom);     
      email.addTo(userEmail);

      email.setSubject(emailSubject);
      if (Logger.isDebugEnabled()) {
        StringBuilder logEmail = new StringBuilder()
            .append("HostName: ").append(email.getHostName()).append("\n")
View Full Code Here

        attachment2.setName("fond3.jpg");
        attachment2.setPath(Play.applicationPath.getPath() + java.io.File.separator + "test" + java.io.File.separator + "fond3.jpg");
        email.attach(attachment);
        email.attach(attachment2);
        email.setFrom("test@localhost");
        email.addTo("test@localhost");
        email.setSubject("test attachments");
        Mail.send(email);
        renderText("OK5");
    }
   
View Full Code Here

                                                }
                                            }

                                            String emailToOutput = "";
                                            for (String address : addresses) {
                                                email.addTo(address);
                                                emailToOutput += address + ", ";
                                            }
                                            email.setFrom(from);

                                            if (subject != null && subject.length() != 0) {
View Full Code Here

            String emailToOutput = "";

            if ((toParticipantId != null && toParticipantId.trim().length() != 0) || (toSpecific != null && toSpecific.trim().length() != 0)) {
                Collection<String> tss = AppUtil.getEmailList(toParticipantId, toSpecific, wfAssignment, appDef);
                for (String address : tss) {
                    email.addTo(address);
                    emailToOutput += address + ", ";
                }
            } else {
                throw new PluginException("no email specified");
            }
View Full Code Here

    HtmlEmail email = new HtmlEmail();
    try {
      addEmbeddables(email);
      addAttachments(email);
      email.addTo(toMail, name);
      email.setSubject(bundle.getMessage(this.templateName, nameParameters));
      email.setHtmlMsg(this.template.getContent());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
View Full Code Here

    try {
     
      addEmbeddables(email);
      addAttachments(email);
     
      email.addTo(toMail, name);
      boolean hasNoSubjectDefined = this.localization.getMessage(name,
          nameParameters).equals("???" + name + "???");
      if (hasNoSubjectDefined) {
        throw new IllegalArgumentException(
            "Subject not defined for email template : " + name);
View Full Code Here

        final HtmlEmail htmlEmail = new HtmlEmail();

        try {
            htmlEmail.setFrom(Config.getEmailFromSmtp(), utils.Config.getSiteName());
            htmlEmail.addTo(email.email, email.user.name);
            htmlEmail.setSubject(Messages.get("emails.validation.email.title", utils.Config.getSiteName()));
            htmlEmail.setHtmlMsg(getMessage(email.confirmUrl));
            htmlEmail.setCharset("utf-8");
            Mailer.send(htmlEmail);
            String escapedTitle = htmlEmail.getSubject().replace("\"", "\\\"");
View Full Code Here

                    + acceptUrl + "\n\n"
                    + Messages.get("transfer.message.deadline") + "\n\n"
                    + Messages.get("transfer.message.thank");

            email.setFrom(Config.getEmailFromSmtp(), pt.sender.name);
            email.addTo(Config.getEmailFromSmtp(), "Yobi");

            User to = User.findByLoginId(pt.destination);
            if (!to.isAnonymous()) {
                email.addBcc(to.email, to.name);
            }
View Full Code Here

        for (String langCode : usersByLang.keySet()) {
            final HtmlEmail email = new HtmlEmail();

            try {
                email.setFrom(Config.getEmailFromSmtp(), event.getSender().name);
                email.addTo(Config.getEmailFromSmtp(), utils.Config.getSiteName());

                for (User receiver : usersByLang.get(langCode)) {
                    email.addBcc(receiver.email, receiver.name);
                }
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.