Class MailService
java.lang.Object
com.eurodyn.qlack.fuse.mailing.service.MailService
Bean implementation for Send and Search Mail functionality
- Author:
- European Dynamics SA.
-
Constructor Summary
ConstructorsConstructorDescriptionMailService
(MailQueueMonitor mailQueueMonitor, EmailMapper emailMapper, EmailRepository emailRepository, AttachmentMapper attachmentMapper, AttachmentRepository attachmentRepository, EmailValidator emailValidator) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup
(Long date, MailConstants.EMAIL_STATUS[] status) Removes all e-mails prior to the specified date having the requested status.void
deleteFromQueue
(String emailId) Delete an email from the queue.Get all email of the provided statusGet an email DTO by IdqueueEmail
(@Valid EmailDTO emailDto) Queue an email.queueEmails
(List<EmailDTO> dtos) Queue a list of Emails.void
Send an emailvoid
sendToDistributionList
(String emailId, String distributionListId) Sends email to a mail distribution lists recipients.void
updateStatus
(String emailId, MailConstants.EMAIL_STATUS status) Update email status
-
Constructor Details
-
MailService
@Autowired public MailService(MailQueueMonitor mailQueueMonitor, EmailMapper emailMapper, EmailRepository emailRepository, AttachmentMapper attachmentMapper, AttachmentRepository attachmentRepository, EmailValidator emailValidator)
-
-
Method Details
-
queueEmails
Queue a list of Emails.- Parameters:
dtos
- - list of email data transfer objects.- Returns:
- List of email ids
-
queueEmail
Queue an email.- Parameters:
emailDto
- - an email data transfer object.- Returns:
- email id
-
cleanup
Removes all e-mails prior to the specified date having the requested status. Warning: If you pass anull
date all emails irrespectively of date will be removed.- Parameters:
date
- - the date before which all e-mails will be removed.status
- - the status to be processed. Be cautious to not include e-mails of status QUEUED as such e-mails might not have been tried to be delivered yet.
-
deleteFromQueue
Delete an email from the queue.- Parameters:
emailId
- - the email id.
-
updateStatus
Update email status- Parameters:
emailId
- the email Idstatus
- the new email status
-
getMail
Get an email DTO by Id- Parameters:
emailId
- the email Id- Returns:
- an email DTO object
-
getByStatus
Get all email of the provided status- Parameters:
status
- the provided status- Returns:
- a list of email with the provided status
-
sendOne
Send an email- Parameters:
emailId
- the emailId
-
sendToDistributionList
Sends email to a mail distribution lists recipients.- Parameters:
emailId
- the email to send.distributionListId
- the mail distribution list.
-