當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。