本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}