当前位置: 首页>>代码示例>>Java>>正文


Java EmailException.printStackTrace方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:fku233,项目名称:MBLive,代码行数:17,代码来源:MailKit.java

示例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();
    }   
        
}
 
开发者ID:MxSIG,项目名称:TableAliasV60,代码行数:23,代码来源:Correo.java

示例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();
	}
}
 
开发者ID:RobCubed,项目名称:ShipworksWeeklyReports,代码行数:21,代码来源:Email.java

示例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();
    }
}
 
开发者ID:yinshipeng,项目名称:sosoapi-base,代码行数:13,代码来源:ApacheMailServiceImpl.java

示例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();
	}
}
 
开发者ID:yancykim,项目名称:support,代码行数:17,代码来源:ValidatorTool.java

示例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();
	}
}
 
开发者ID:yancykim,项目名称:support,代码行数:17,代码来源:EmailUtil.java

示例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();
    }
}
 
开发者ID:yinshipeng,项目名称:sosoapi-base,代码行数:13,代码来源:ApacheMailServiceImpl.java

示例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();
	}

}
 
开发者ID:Spirals-Team,项目名称:peak-forecast,代码行数:28,代码来源:EmailImpl.java

示例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;
}
 
开发者ID:GlacierSoft,项目名称:netloan-project,代码行数:75,代码来源:RegisterController.java


注:本文中的org.apache.commons.mail.EmailException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。