本文整理汇总了Java中org.apache.commons.mail.EmailException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java EmailException.printStackTrace方法的具体用法?Java EmailException.printStackTrace怎么用?Java EmailException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.mail.EmailException
的用法示例。
在下文中一共展示了EmailException.printStackTrace方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: send
import org.apache.commons.mail.EmailException; //导入方法依赖的package包/类
public static void send(Mail mail) {
HtmlEmail email = new HtmlEmail();
try {
email.setHostName(mail.getHost());
email.setCharset(Config.UTF_8);
email.addTo(mail.getReceiver());
email.setFrom(mail.getSender(), mail.getName());
email.setAuthentication(mail.getUsername(), mail.getPassword());
email.setSubject(mail.getSubject());
email.setMsg(mail.getMessage());
email.setSmtpPort(mail.getSmtpPort());
email.send();
} catch (EmailException e) {
e.printStackTrace();
}
}
示例2: envia
import org.apache.commons.mail.EmailException; //导入方法依赖的package包/类
public static void envia(Registrar reg) {
try {
SimpleEmail email = new SimpleEmail();
email.setHostName("10.1.8.102");
email.addTo("[email protected]");
//email.addCc("[email protected]");
email.addCc("[email protected]");
email.addCc("[email protected]");
email.addCc("[email protected]");
//email.addCc("[email protected]");
//email.addCc("[email protected]");
email.setFrom("[email protected]");
email.setSubject("Error en tablealias");
String msg = String.format("%nServidor %s, pathInfo %s%nParametros %s ",reg.getNomServidor(), reg.getPagAccesa(), reg.getParametros());
email.setMsg("Categoria: " + reg.getCategoria() + " , Descripcion " + reg.getDescripcion() + msg + " \n Navegador:" + reg.getExplorador());
email.send();
} catch (EmailException ex1) {
ex1.printStackTrace();
}
}
示例3: sendEmail
import org.apache.commons.mail.EmailException; //导入方法依赖的package包/类
public void sendEmail() {
HtmlEmail email = new HtmlEmail();
try {
email.setHostName(emailHostName);
email.setSmtpPort(smtpPort);
email.setAuthenticator(new DefaultAuthenticator(emailLogin,
emailPassword));
email.setSSLOnConnect(emailSSL);
email.setStartTLSEnabled(startTLS);
email.setFrom(emailSender);
email.setSubject(title);
email.setHtmlMsg(htmlMessage);
email.addTo(emailRecipient);
email.send();
System.out.println("Email sent: " + title);
} catch (EmailException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例4: sendHtmlMail
import org.apache.commons.mail.EmailException; //导入方法依赖的package包/类
private void sendHtmlMail(String fromEmail, String fromPasswd,String fromName,
String host,List<String> toEmailList,MailMsg mailMsg){
HtmlEmail email = new HtmlEmail();
try {
initEmail(email, fromEmail, fromPasswd, fromName,host, toEmailList, mailMsg);
email.setHtmlMsg(mailMsg.getContent());
email.send();
}
catch (EmailException e) {
e.printStackTrace();
}
}
示例5: sendEmail
import org.apache.commons.mail.EmailException; //导入方法依赖的package包/类
public static void sendEmail(String emailAddr, String verifyCode) {
SimpleEmail email = new SimpleEmail();
email.setHostName("smtp.163.com");
email.setAuthentication("[email protected]", "xingji19890326");
email.setCharset("UTF-8");
try{
email.addTo(emailAddr);
email.setFrom("[email protected]");
email.setSubject("Actsocial dashborad Check");
email.setMsg(verifyCode);
email.send();
}catch(EmailException e){
e.printStackTrace();
}
}
示例6: sendEmail
import org.apache.commons.mail.EmailException; //导入方法依赖的package包/类
public static void sendEmail(String emailAddr, String verifyCode) {
SimpleEmail email = new SimpleEmail();
email.setHostName("smtp.gmail.com");
email.setAuthentication("[email protected]", "xingji19890326");
email.setCharset("UTF-8");
try{
email.addTo(emailAddr);
email.setFrom("[email protected]");
email.setSubject("Actsocial dashborad Check");
email.setMsg(verifyCode);
email.send();
}catch(EmailException e){
e.printStackTrace();
}
}
示例7: sendTextMail
import org.apache.commons.mail.EmailException; //导入方法依赖的package包/类
private void sendTextMail(String fromEmail, String fromPasswd,String fromName,
String host,List<String> toEmailList,MailMsg mailMsg){
SimpleEmail email = new SimpleEmail();
try {
initEmail(email, fromEmail, fromPasswd,fromName, host, toEmailList, mailMsg);
email.setMsg(mailMsg.getContent());
email.send();
}
catch (EmailException e) {
e.printStackTrace();
}
}
示例8: send
import org.apache.commons.mail.EmailException; //导入方法依赖的package包/类
@Override
public void send(String message) {
try {
Email email = new SimpleEmail();
email.setHostName("smtp.googlemail.com");
email.setSmtpPort(465);
//email.setAuthenticator(new DefaultAuthenticator("username", "password"));
email.setAuthenticator(new DefaultAuthenticator("[email protected]", "motdepasse"));
email.setSSLOnConnect(true);
email.setFrom("[email protected]");
email.setSubject("Alert PeakForecast");
email.setMsg(message);
String listtabmail[]= listEmails.split(" ");
for (int i = 0; i < listtabmail.length; i++) {
email.addTo(listtabmail[i]);
}
email.send();
System.out.println("Message Email envoyé !!!");
} catch (EmailException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例9: getPasswrod
import org.apache.commons.mail.EmailException; //导入方法依赖的package包/类
/**
* @Title: getpassword
* @Description: TODO(会员忘记密码,通过邮箱获取密码)
* @param @param member
* @param @param session
* @param @return设定文件
* @return Object 返回类型
* @throws
*
*/
@RequestMapping(value = "/getPasswrod.htm", method = RequestMethod.GET)
public Object getPasswrod(@Valid
String useremal, HttpServletRequest request, HttpSession session) {
JqReturnJson returnResult = new JqReturnJson();// 构建返回结果,默认结果为false
Member member = new Member();
if (useremal == null) {
returnResult.setMsg("邮箱不能为空");
// 邮箱不存在,就返回这个消息给前台
session.setAttribute("emailStatus", "false");
return "retrievePassword/retrievePasswordEmail";
}
member = memberService.retrieveEmail(useremal);
if (member == null) {
returnResult.setMsg("邮箱不存在");
// 邮箱不存在,就返回这个消息给前台
session.setAttribute("emailStatus", "false");
return "retrievePassword/retrievePasswordEmail";
}
returnResult.setSuccess(true);
ModelAndView mav = new ModelAndView("retrievePassword/sendMail");
// 创建一个临时ID
String retrieveId = "" + Math.random() * Math.random();
/**
* 得到web系统url路径的方法
* */
// 得到web的url路径:http://localhost:8080/ssh1/
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
// 邮件发送成功后,用户点在邮箱中点击这个链接回到设置新密码网站。
String url = basePath + "mailBackPassword.htm?retrieveId=" + retrieveId;
// 将验证邮箱链接后面的registerId存到session中
session.setAttribute(retrieveId, retrieveId);
session.setAttribute("userEmail", useremal);// 把用户邮箱保存起来
// 把用户邮箱存起来
// 设置session的有效时间,为10分钟,10分钟内没有点击链接的话,设置密码将失败
session.setMaxInactiveInterval(600);
// 基于org.apache.commons.mail,封装好的mail,发邮件流程比较简单,比原生态mail简单。
HtmlEmail email = new HtmlEmail();
email.setHostName("smtp.qq.com");// QQ郵箱服務器
// email.setHostName("smtp.163.com");// 163郵箱服務器
// email.setHostName("smtp.gmail.com");// gmail郵箱服務器
email.setSmtpPort(465);// 设置端口号
email.setAuthenticator(new DefaultAuthenticator("[email protected]", "zx5304960"));// 用[email protected]这个邮箱发送验证邮件的
email.setTLS(true);// tls要设置为true,没有设置会报错。
email.setSSL(true);// ssl要设置为true,没有设置会报错。
try {
email.setFrom("[email protected]", "冰川网贷管理员", "UTF-8");
// email.setFrom("[email protected]", "[email protected]",
// "UTF-8");
// email.setFrom("[email protected]", "[email protected]", "UTF-8");
} catch (EmailException e1) {
e1.printStackTrace();
}
email.setCharset("UTF-8");// 没有设置会乱码。
try {
email.setSubject("冰川网贷密码找回");// 设置邮件名称
email.setHtmlMsg("尊敬的会员:<font color='blue'>" + member.getMemberName() + "</font>,请点击<a href='" + url + "'>" + url + "</a>完成新密码设置!");// 设置邮件内容
email.addTo(useremal);// 给会员发邮件
email.send();// 邮件发送
} catch (EmailException e) {
throw new RuntimeException(e);
}
return mav;
}