當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleMailMessage.getText方法代碼示例

本文整理匯總了Java中org.springframework.mail.SimpleMailMessage.getText方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleMailMessage.getText方法的具體用法?Java SimpleMailMessage.getText怎麽用?Java SimpleMailMessage.getText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.mail.SimpleMailMessage的用法示例。


在下文中一共展示了SimpleMailMessage.getText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sendEmailInvite

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Send the invite to a user who already exists in the system.
 * 
 * @param invite
 */
 public void sendEmailInvite(IrUser invitingUser, GroupWorkspace groupWorkspace, String email, String inviteMessage)	{
	SimpleMailMessage message = new SimpleMailMessage(userWorkspaceInviteUserExists);
	message.setTo(email);
	
	String subject = message.getSubject();
	subject = StringUtils.replace(subject, "%FIRST_NAME%", invitingUser.getFirstName());
	subject = StringUtils.replace(subject, "%LAST_NAME%",  invitingUser.getLastName());
	message.setSubject(subject);
	
	String text = message.getText();
	
	text = StringUtils.replace(text, "%NAME%", groupWorkspace.getName());
	text = StringUtils.replace(text, "%BASE_WEB_APP_PATH%", baseWebAppPath);
	if( inviteMessage != null && !inviteMessage.trim().equals(""))
	{
	    text = text.concat(inviteMessage);
	}
	message.setText(text);
	sendEmail(message);
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:26,代碼來源:DefaultGroupWorkspaceInviteService.java

示例2: sendEmailToNotExistingUser

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Send an email to a user who has not yet registered in the system
 * 
 * @param invite
 */
private void sendEmailToNotExistingUser(GroupWorkspaceEmailInvite invite)
{
	SimpleMailMessage message = new SimpleMailMessage(userWorkspaceInviteUserNotExistsMessage);
	message.setTo(invite.getInviteToken().getEmail());

	String subject = message.getSubject();
	subject = StringUtils.replace(subject, "%FIRST_NAME%", invite.getInviteToken().getInvitingUser().getFirstName());
	subject = StringUtils.replace(subject, "%LAST_NAME%", invite.getInviteToken().getInvitingUser().getLastName());
	message.setSubject(subject);

	String text = message.getText();
	
	text = StringUtils.replace(text, "%NAME%", invite.getGroupWorkspace().getName());
	text = StringUtils.replace(text, "%TOKEN%", invite.getInviteToken().getToken());
	text = StringUtils.replace(text, "%BASE_WEB_APP_PATH%", baseWebAppPath);
	if( invite.getInviteToken().getInviteMessage() != null )
	{
	    text = text.concat(invite.getInviteToken().getInviteMessage());
	}
	message.setText(text);
	sendEmail(message);
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:28,代碼來源:DefaultGroupWorkspaceInviteService.java

示例3: sendEmailForForgotPassword

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Sends email with the token to change password
 * 
 * @see edu.ur.ir.user.UserService#sendEmailForForgotPassword(String, String)
 */
public void sendEmailForForgotPassword(String token, String email) {

	SimpleMailMessage message = new SimpleMailMessage(passwordTokenMessage);
	message.setTo(email);
	String text = message.getText();
	text = StringUtils.replace(text, "%TOKEN%", token);
	text = StringUtils.replace(text, "%BASE_WEB_APP_PATH%", baseWebAppPath);
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:22,代碼來源:DefaultUserService.java

示例4: sendEmailForEmailVerification

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Sends email with the token to verify email
 * 
 * @see edu.ur.ir.user.UserService#sendEmailForEmailVerification(String, String, String)
 */
public void sendEmailForEmailVerification(String token, String email, String username) {

	SimpleMailMessage message = new SimpleMailMessage(emailVerificationMessage);
	message.setTo(email);
	String text = message.getText();
	text = StringUtils.replace(text, "%TOKEN%", token);
	text = StringUtils.replace(text, "%BASE_WEB_APP_PATH%", baseWebAppPath);
	text = StringUtils.replace(text, "%USERNAME%", username);
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:23,代碼來源:DefaultUserService.java

示例5: sendAccountCreationEmailToUser

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Sends email to user when an account is created by admin
 * 
 * @see edu.ur.ir.user.service.UserService#sendAccountCreationEmailToUser(IrUser, String)
 */
public void sendAccountCreationEmailToUser(IrUser user, String password) {

	SimpleMailMessage message = new SimpleMailMessage(accountCreationMessage);
	message.setTo(user.getDefaultEmail().getEmail());
	String text = message.getText();
	text = StringUtils.replace(text, "%USERNAME%", user.getUsername());
	text = StringUtils.replace(text, "%PASSWORD%", password);
	text = StringUtils.replace(text, "%BASE_WEB_APP_PATH%", baseWebAppPath);
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}

}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:24,代碼來源:DefaultUserService.java

示例6: emailNewPassword

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Sends email to user when the admin resets the password
 * 
 * @see edu.ur.ir.user.service.UserService#emailNewPassword(IrUser, String, String)
 */
public void emailNewPassword(IrUser user, String password, String emailMessage) {

	SimpleMailMessage message = new SimpleMailMessage(resetPasswordMessage);
	message.setTo(user.getDefaultEmail().getEmail());
	String text = message.getText();
	text = StringUtils.replace(text, "%PASSWORD%", password);
	text = StringUtils.replace(text, "%MESSAGE%", emailMessage);
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}

}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:23,代碼來源:DefaultUserService.java

示例7: sendAffiliationConfirmationEmail

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Sends affiliation confirmation email to user
 * 
 * @see edu.ur.ir.user.UserService#sendAffiliationConfirmationEmail(IrUser, Affiliation)
 */
public void sendAffiliationConfirmationEmail(IrUser user, Affiliation affiliation) {

	SimpleMailMessage message = new SimpleMailMessage(userAffiliationMessage);
	message.setTo(user.getDefaultEmail().getEmail());
	String text = message.getText();
	text = StringUtils.replace(text, "%USERNAME%", user.getUsername());
	text = StringUtils.replace(text, "%AFFILIATION%", affiliation.getName());
	text = StringUtils.replace(text, "%BASE_WEB_APP_PATH%", baseWebAppPath);
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:23,代碼來源:DefaultUserService.java

示例8: sendAffiliationVerificationEmailForUser

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Sends email to admin to verify the affiliation chosen by the user
 * 
 * @param user User whose affiliation needs to be verified
 */
public void sendAffiliationVerificationEmailForUser(IrUser user) {
	List<IrUser> approvers = getUserByRole(IrRole.APPROVE_USER_AFFILIATION_ROLE);
	
	List<String> toAddresses = new ArrayList<String>();
	
	for (IrUser approver: approvers) {
		toAddresses.add((String)(approver.getDefaultEmail().getEmail()));
	}
	
	SimpleMailMessage message = new SimpleMailMessage(affiliationVerificationMessage);
	message.setTo(toAddresses.toArray(new String[0]));
	
	String text = message.getText();
	text = StringUtils.replace(text, "%USERNAME%", user.getUsername());
	text = StringUtils.replace(text, "%AFFILIATION%", user.getAffiliation().getName());
	text = StringUtils.replace(text, "%BASE_WEB_APP_PATH%", baseWebAppPath);
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:31,代碼來源:DefaultUserService.java

示例9: sendAccountVerificationEmailForUser

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Sends email to user with link to login
 * 
 * @param user registered user 
 */
public void sendAccountVerificationEmailForUser(String token, String email, String username) {

	SimpleMailMessage message  = new SimpleMailMessage(accountVerificationMessage);
	message.setTo(email);
	String text = message.getText();
	text = StringUtils.replace(text, "%USERNAME%", username);
	text = StringUtils.replace(text, "%TOKEN%", token);
	text = StringUtils.replace(text, "%BASE_WEB_APP_PATH%", baseWebAppPath);
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:23,代碼來源:DefaultUserService.java

示例10: sendPendingAffiliationEmailForUser

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Sends email to user that the affiliation is currently being verified
 * 
 * @param user user 
 */
public void sendPendingAffiliationEmailForUser(IrUser user) {

	SimpleMailMessage message = new SimpleMailMessage(userPendingAffiliationMessage);
	message.setTo(user.getDefaultEmail().getEmail());
	String text = message.getText();
	text = StringUtils.replace(text, "%USERNAME%", user.getUsername());
	text = StringUtils.replace(text, "%AFFILIATION%", user.getAffiliation().getName());
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:22,代碼來源:DefaultUserService.java

示例11: sendItemAcceptanceEmail

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Send publication acceptance email
 * 
 * @see edu.ur.ir.institution.ReviewableItemService#sendItemAcceptanceEmail(ReviewableItem)
 */
public void sendItemAcceptanceEmail(ReviewableItem item) {

	SimpleMailMessage message = new SimpleMailMessage(itemAcceptedMessage);
	message.setTo(item.getItem().getOwner().getDefaultEmail().getEmail());
	String text = message.getText();
	text = StringUtils.replace(text, "%FIRSTNAME%", item.getItem().getOwner().getFirstName());
	text = StringUtils.replace(text, "%LASTNAME%", item.getItem().getOwner().getLastName());
	text = StringUtils.replace(text, "%ITEMNAME%", item.getItem().getName());
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:23,代碼來源:DefaultReviewableItemService.java

示例12: sendItemRejectionEmail

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
 * Send publication rejection email
 * 
 * @see edu.ur.ir.user.UserService#sendItemRejectionEmail(ReviewableItem)
 */
public void sendItemRejectionEmail(ReviewableItem item) {

	SimpleMailMessage message = new SimpleMailMessage(itemRejectedMessage);
	message.setTo(item.getItem().getOwner().getDefaultEmail().getEmail());
	String text = message.getText();
	text = StringUtils.replace(text, "%FIRSTNAME%", item.getItem().getOwner().getFirstName());
	text = StringUtils.replace(text, "%LASTNAME%", item.getItem().getOwner().getLastName());
	text = StringUtils.replace(text, "%ITEMNAME%", item.getItem().getName());
	text = StringUtils.replace(text, "%REASON%", item.getReasonForRejection());
	message.setText(text);

	try {
		mailSender.send(message);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new IllegalStateException(e);
	}
}
 
開發者ID:nate-rcl,項目名稱:irplus,代碼行數:24,代碼來源:DefaultReviewableItemService.java

示例13: send

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
@Override
public void send(final SimpleMailMessage message) throws MailException {
    try {

        final String content = message.getText();
        final Properties javaMailProperties = getJavaMailProperties();
        javaMailProperties.setProperty("mailContent", content);
    } catch (final Exception e) {
        throw new MailPreparationException(e);
    }
}
 
開發者ID:LIBCAS,項目名稱:ARCLib,代碼行數:12,代碼來源:MockMailSender.java

示例14: sendEmail

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
	 * 이메일을 전송한다.
	 * 
	 * @param mntrngLog
	 *            모니터링 대상정보
	 * @return
	 * 
	 */
	private void sendEmail(DbMntrngLogVO mntrngLog) {
		String subject = null;
		String text = null;
		String errorContents = null;

		SimpleMailMessage msg = new SimpleMailMessage(this.mntrngMessage);
		// 수신자
		msg.setTo(mntrngLog.getMngrEmailAddr());
		// 메일제목
		subject = msg.getSubject();
		subject = StringUtil.replace(subject, "{모니터링종류}", "DB서비스모니터링");
		msg.setSubject(subject);
		// 메일내용
		text = msg.getText();
		text = StringUtil.replace(text, "{모니터링종류}", "DB서비스모니터링");
		errorContents = "데이타소스명 : " + mntrngLog.getDataSourcNm() + "\n";
		errorContents = errorContents + "서버명  : " + mntrngLog.getServerNm() + "\n";
		errorContents = errorContents + "DBMS종류 : " + mntrngLog.getDbmsKindNm() + "\n";
		errorContents = errorContents + "체크SQL : " + mntrngLog.getCeckSql() + "\n";
		errorContents = errorContents + "상태 : " + mntrngLog.getMntrngSttusNm() + "\n";
		errorContents = errorContents + "모니터링시각 : " + mntrngLog.getCreatDt() + "\n";
		errorContents = errorContents + "에러메시지 : " + mntrngLog.getLogInfo() + "\n";
		text = StringUtil.replace(text, "{에러내용}", errorContents);
		msg.setText(text);

//		this.mntrngMailSender.send(msg);
	}
 
開發者ID:aramsoft,項目名稱:aramcomp,代碼行數:36,代碼來源:DbMntrngScheduling.java

示例15: sendEmail

import org.springframework.mail.SimpleMailMessage; //導入方法依賴的package包/類
/**
	 * 이메일을 전송한다.
	 * 
	 * @return
	 * 
	 * @param target
	 */
	private void sendEmail(ProcessMonVO target) {

		String subject = null;
		String text = null;
		String errorContents = null;

		SimpleMailMessage msg = new SimpleMailMessage(this.mntrngMessage);
		// 수신자
		msg.setTo(target.getMngrEmailAddr());
		// 메일제목
		subject = msg.getSubject();
		subject = StringUtil.replace(subject, "{모니터링종류}", "프로세스모니터링");
		msg.setSubject(subject);
		// 메일내용
		text = msg.getText();
		text = StringUtil.replace(text, "{모니터링종류}", "프로세스모니터링");
		errorContents = "프로세스명 : ";
		errorContents += target.getProcessNm();
		errorContents += "\n";
		errorContents += "상태 : ";
		errorContents += target.getProcsSttus();
		errorContents += "\n";
		errorContents += "모티터링 시각 : ";
		errorContents += DateUtil.convertDate(target.getCreatDt(), "", "", "");
		errorContents += "\n";
		if (target.getLogInfo() != null && !target.getLogInfo().equals("")) {
			errorContents += target.getProcessNm() + " 의 프로세스 상태가 비정상입니다.  \n로그를 확인해주세요.";
		}
		text = StringUtil.replace(text, "{에러내용}", errorContents);
		msg.setText(text);

//		this.mntrngMailSender.send(msg);
	}
 
開發者ID:aramsoft,項目名稱:aramcomp,代碼行數:41,代碼來源:ProcessMonScheduling.java


注:本文中的org.springframework.mail.SimpleMailMessage.getText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。