Package org.apache.commons.mail

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


                html = text;
            }

            mail.setHtmlMsg(html);
            mail.setTextMsg(text);
            mail.send();
            return true;
        } catch (EmailException ex) {
            System.err.print(ex);
            return false;
        }
View Full Code Here


            email.setTextMsg(body);
            email.setFrom("esper-is-awesome@example.com");
            email.setTo(Arrays.asList(new InternetAddress(config.getRecipients())));
            email.setHostName(config.getHost());
            email.setSmtpPort(config.getPort());
            email.send();
        }
        catch (Exception ex) {
            log.warn("Could not create or send email", ex);
        }
    }
View Full Code Here

  public void sendHtml( ConnectionConfig conf, MailAddress mailAddress, MailContent mail ){   
    HtmlEmail email = new HtmlEmail();     
    fillConfig( email,conf,mailAddress,mail );
   
    try{
      email.send();
    }catch( org.apache.commons.mail.EmailException ee){
      throw new MailException( ee );
    }   
  }
 
View Full Code Here

      }
      if (emails != null && emails.size() > 0) {
        for (String to : emails) {
          email.addTo(to);
        }
        email.send();
      }
      return true;
    } catch (Exception e) {
      Cat.logError(e);
    }
View Full Code Here

      template = freeMarkerConfig.getTemplate(getFileName(templatePath),new Locale("Zh_cn"), "UTF-8");
      // 模板内容转换为string
      String htmlText = FreeMarkerTemplateUtils.processTemplateIntoString(template, map);
      org.jeecgframework.core.util.LogUtil.info(htmlText);
        hemail.setMsg(htmlText);
        hemail.send();
        org.jeecgframework.core.util.LogUtil.info("email send true!");
      } catch (Exception e) {
        e.printStackTrace();
        org.jeecgframework.core.util.LogUtil.info("email send error!");
      }
View Full Code Here

      hemail.addTo(toMailAddr);
      hemail.setFrom(from, fromName);
      hemail.setAuthentication(username, password);
      hemail.setSubject(subject);
      hemail.setMsg(message);
      hemail.send();
      org.jeecgframework.core.util.LogUtil.info("email send true!");
    } catch (Exception e) {
          e.printStackTrace();
          org.jeecgframework.core.util.LogUtil.info("email send error!");
        }
View Full Code Here

    // set the alternative message
    email.setTextMsg(mailInfo.getAltermessage());
    // send the email

    email.send();
  }

  /**
   * 以文本格式发送邮件
   *
 
View Full Code Here

           
            .append("SentDate: ").append(email.getSentDate()).append("\n");
        Logger.debug("Password Recovery is ready to send: \n" + logEmail.toString());
      }
      email.send();

    catch (EmailException authEx){
      Logger.error("ERROR SENDING MAIL:" + ExceptionUtils.getStackTrace(authEx));
      throw new PasswordRecoveryException (errorString + " Could not reach the mail server. Please contact the server administrator");
    catch (Exception e) {
View Full Code Here

                                            }
                                            email.setCharset("UTF-8");
                                           
                                            try {
                                                LogUtil.info(UserNotificationAuditTrail.class.getName(), "Sending email from=" + email.getFromAddress().toString() + " to=" + emailToOutput + ", subject=Workflow - Pending Task Notification");
                                                email.send();
                                                LogUtil.info(UserNotificationAuditTrail.class.getName(), "Sending email completed for subject=" + email.getSubject());
                                            } catch (EmailException ex) {
                                                LogUtil.error(UserNotificationAuditTrail.class.getName(), ex, "Error sending email");
                                            }
                                        }
View Full Code Here

                public void run() {
                    try {
                        HostManager.setCurrentProfile(profile);
                        LogUtil.info(EmailTool.class.getName(), "EmailTool: Sending email from=" + fromStr + ", to=" + to + "cc=" + cc + ", subject=" + email.getSubject());
                        email.send();
                        LogUtil.info(EmailTool.class.getName(), "EmailTool: Sending email completed for subject=" + email.getSubject());
                    } catch (EmailException ex) {
                        LogUtil.error(EmailTool.class.getName(), ex, "");
                    }
                }
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.