Class EmailSenderServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.EmailSenderServiceImpl
-
- All Implemented Interfaces:
EmailSenderService
@Service public class EmailSenderServiceImpl extends java.lang.Object implements EmailSenderService
-
-
Field Summary
Fields Modifier and Type Field Description private CommonProperties
commonProperties
private EmailProperties
emailProperties
org.springframework.mail.javamail.JavaMailSender
emailSender
private PageRenderService
pageRenderService
private ProfileRepository
profileRepository
private TemplateLocatorService
templateLocatorService
private TokenService
tokenService
private WebSiteSettingsRepository
webSiteSettingsRepository
-
Constructor Summary
Constructors Constructor Description EmailSenderServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
attachFile(java.lang.String filePath, javax.mail.Multipart multipart, javax.mail.internet.MimeBodyPart messageBodyPart)
java.lang.String
getContactSupplierTemplate(java.lang.String messageText, java.lang.String fullName, java.lang.String mailTo)
This method returns template.java.lang.String
getMessageNotificationEmailTemplate(java.lang.String messageText)
This method returns template.java.lang.String
getOrderConfirmationEmail(EmailMessage emailMessage)
This method returns template.java.lang.String
getResetPasswordTemplate(java.lang.String fullName, java.lang.String token)
This method returns template.java.lang.String
getTariffBookingEmailTemplate(java.lang.String fullName)
This method returns template.java.lang.String
getUploadRequestEmailTemplate(EmailMessage emailMessage)
This method returns template.java.lang.String
getVerificationEmailTemplate(java.lang.String fullName, java.lang.String token)
This method returns template.java.lang.String
getWelcomeEmailTemplate(java.lang.String fullName)
This method returns template.void
sendEmailWithAttachments(java.lang.String to, java.lang.String subject, java.lang.String text, java.util.ArrayList<java.lang.String> attachments)
This method send a email.void
sendMimeMessage(java.lang.String to, java.lang.String subject, java.lang.String message)
This method send a email.void
sendOrderConfirmationEmail(EmailMessage emailMessage)
Sends a success email for the order.void
sendResetPasswordEmail(User user)
This method sending a reset password link to user emailvoid
sendSimpleEmail(java.lang.String to, java.lang.String subject, java.lang.String text)
This method send a email.void
sendVerificationEmail(User user)
This method sending a verification link to user emailvoid
sendWelcomeEmail(User user)
This method sending a welcome email
-
-
-
Field Detail
-
emailSender
@Autowired public org.springframework.mail.javamail.JavaMailSender emailSender
-
tokenService
@Autowired private TokenService tokenService
-
templateLocatorService
@Autowired private TemplateLocatorService templateLocatorService
-
pageRenderService
@Autowired private PageRenderService pageRenderService
-
webSiteSettingsRepository
@Autowired private WebSiteSettingsRepository webSiteSettingsRepository
-
emailProperties
@Autowired private EmailProperties emailProperties
-
profileRepository
@Autowired private ProfileRepository profileRepository
-
commonProperties
@Autowired private CommonProperties commonProperties
-
-
Method Detail
-
getVerificationEmailTemplate
public java.lang.String getVerificationEmailTemplate(java.lang.String fullName, java.lang.String token)
Description copied from interface:EmailSenderService
This method returns template.- Specified by:
getVerificationEmailTemplate
in interfaceEmailSenderService
- Parameters:
fullName
- field for database entitytoken
- field for database entity- Returns:
- template of email
-
getWelcomeEmailTemplate
public java.lang.String getWelcomeEmailTemplate(java.lang.String fullName)
Description copied from interface:EmailSenderService
This method returns template.- Specified by:
getWelcomeEmailTemplate
in interfaceEmailSenderService
- Parameters:
fullName
- field for database entity- Returns:
- template of email
-
getResetPasswordTemplate
public java.lang.String getResetPasswordTemplate(java.lang.String fullName, java.lang.String token)
Description copied from interface:EmailSenderService
This method returns template.- Specified by:
getResetPasswordTemplate
in interfaceEmailSenderService
- Parameters:
fullName
- field for database entitytoken
- field for database entity- Returns:
- template of email
-
getMessageNotificationEmailTemplate
public java.lang.String getMessageNotificationEmailTemplate(java.lang.String messageText)
Description copied from interface:EmailSenderService
This method returns template.- Specified by:
getMessageNotificationEmailTemplate
in interfaceEmailSenderService
- Parameters:
messageText
- field for database entity- Returns:
- template of email
-
getContactSupplierTemplate
public java.lang.String getContactSupplierTemplate(java.lang.String messageText, java.lang.String fullName, java.lang.String mailTo)
Description copied from interface:EmailSenderService
This method returns template.- Specified by:
getContactSupplierTemplate
in interfaceEmailSenderService
- Parameters:
messageText
- field for database entityfullName
- field for database entitymailTo
- field for database entity- Returns:
- template of email
-
getTariffBookingEmailTemplate
public java.lang.String getTariffBookingEmailTemplate(java.lang.String fullName)
Description copied from interface:EmailSenderService
This method returns template.- Specified by:
getTariffBookingEmailTemplate
in interfaceEmailSenderService
- Parameters:
fullName
- field for database entity- Returns:
- template of email
-
getUploadRequestEmailTemplate
public java.lang.String getUploadRequestEmailTemplate(EmailMessage emailMessage)
Description copied from interface:EmailSenderService
This method returns template.- Specified by:
getUploadRequestEmailTemplate
in interfaceEmailSenderService
- Parameters:
emailMessage
- email entity- Returns:
- template of email
-
getOrderConfirmationEmail
public java.lang.String getOrderConfirmationEmail(EmailMessage emailMessage)
Description copied from interface:EmailSenderService
This method returns template.- Specified by:
getOrderConfirmationEmail
in interfaceEmailSenderService
- Parameters:
emailMessage
- email entity- Returns:
- template of email
-
sendSimpleEmail
@Async("asyncTaskExecutor") public void sendSimpleEmail(java.lang.String to, java.lang.String subject, java.lang.String text)
Description copied from interface:EmailSenderService
This method send a email.- Specified by:
sendSimpleEmail
in interfaceEmailSenderService
- Parameters:
to
- field database entity whose will be send emailsubject
- field for database entity and subject for emailtext
- field for database entity and content for email
-
sendEmailWithAttachments
@Async("asyncTaskExecutor") public void sendEmailWithAttachments(java.lang.String to, java.lang.String subject, java.lang.String text, java.util.ArrayList<java.lang.String> attachments)
Description copied from interface:EmailSenderService
This method send a email.- Specified by:
sendEmailWithAttachments
in interfaceEmailSenderService
- Parameters:
to
- field database entity whose will be send emailsubject
- field for database entity and subject for emailtext
- field for database entity and content for emailattachments
- the list of attachments
-
sendMimeMessage
@Async("asyncTaskExecutor") public void sendMimeMessage(java.lang.String to, java.lang.String subject, java.lang.String message)
Description copied from interface:EmailSenderService
This method send a email.- Specified by:
sendMimeMessage
in interfaceEmailSenderService
- Parameters:
to
- field database entity whose will be sent emailsubject
- field for database entity and subject for emailmessage
- field for database entity and content for email
-
sendVerificationEmail
public void sendVerificationEmail(User user)
Description copied from interface:EmailSenderService
This method sending a verification link to user email- Specified by:
sendVerificationEmail
in interfaceEmailSenderService
- Parameters:
user
- registered user
-
sendWelcomeEmail
public void sendWelcomeEmail(User user)
Description copied from interface:EmailSenderService
This method sending a welcome email- Specified by:
sendWelcomeEmail
in interfaceEmailSenderService
- Parameters:
user
- registered user
-
sendResetPasswordEmail
public void sendResetPasswordEmail(User user)
Description copied from interface:EmailSenderService
This method sending a reset password link to user email- Specified by:
sendResetPasswordEmail
in interfaceEmailSenderService
- Parameters:
user
- registered user
-
sendOrderConfirmationEmail
public void sendOrderConfirmationEmail(EmailMessage emailMessage)
Description copied from interface:EmailSenderService
Sends a success email for the order.This method sends a success email for the order specified by the given email message.
- Specified by:
sendOrderConfirmationEmail
in interfaceEmailSenderService
- Parameters:
emailMessage
- the email message object containing the details of the success email
-
attachFile
private void attachFile(java.lang.String filePath, javax.mail.Multipart multipart, javax.mail.internet.MimeBodyPart messageBodyPart) throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
-
-