| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service.mail;
|
1 |
package com.spice.profitmandi.service.mail;
|
| 2 |
|
2 |
|
| 3 |
import com.spice.profitmandi.common.mail.MailQueue;
|
- |
|
| 4 |
import com.spice.profitmandi.common.mail.MailRequest;
|
3 |
import com.spice.profitmandi.common.mail.MailRequest;
|
| 5 |
import com.spice.profitmandi.common.mail.MailSenderType;
|
4 |
import com.spice.profitmandi.common.mail.MailSenderType;
|
| 6 |
import com.spice.profitmandi.common.util.Utils;
|
5 |
import com.spice.profitmandi.common.util.Utils;
|
| 7 |
import com.spice.profitmandi.dao.entity.mail.MailOutbox;
|
6 |
import com.spice.profitmandi.dao.entity.mail.MailOutbox;
|
| 8 |
import com.spice.profitmandi.dao.entity.mail.MailOutboxAttachment;
|
7 |
import com.spice.profitmandi.dao.entity.mail.MailOutboxAttachment;
|
| Line 30... |
Line 29... |
| 30 |
import java.time.LocalDateTime;
|
29 |
import java.time.LocalDateTime;
|
| 31 |
import java.util.ArrayList;
|
30 |
import java.util.ArrayList;
|
| 32 |
import java.util.List;
|
31 |
import java.util.List;
|
| 33 |
|
32 |
|
| 34 |
@Service
|
33 |
@Service
|
| 35 |
public class MailOutboxService implements MailQueue {
|
34 |
public class MailOutboxService {
|
| 36 |
|
35 |
|
| 37 |
private static final Logger LOGGER = LogManager.getLogger(MailOutboxService.class);
|
36 |
private static final Logger LOGGER = LogManager.getLogger(MailOutboxService.class);
|
| 38 |
|
37 |
|
| 39 |
/**
|
38 |
/**
|
| 40 |
* The two ways this system can send mail. There is no third.
|
39 |
* The two ways this system can send mail. There is no third.
|
| Line 160... |
Line 159... |
| 160 |
|
159 |
|
| 161 |
/**
|
160 |
/**
|
| 162 |
* Every other queueing method on this class is a delegate to this one. They
|
161 |
* Every other queueing method on this class is a delegate to this one. They
|
| 163 |
* are kept because ~112 call sites use them; new code should use this.
|
162 |
* are kept because ~112 call sites use them; new code should use this.
|
| 164 |
*/
|
163 |
*/
|
| 165 |
@Override
|
- |
|
| 166 |
public void queue(MailRequest request) {
|
164 |
public void queue(MailRequest request) {
|
| 167 |
String senderType = request.getSender() == MailSenderType.GOOGLE ? SENDER_GOOGLE : SENDER_RELAY;
|
165 |
String senderType = request.getSender() == MailSenderType.GOOGLE ? SENDER_GOOGLE : SENDER_RELAY;
|
| 168 |
if (request.hasAttachments()) {
|
166 |
if (request.hasAttachments()) {
|
| 169 |
queueMailWithAttachments(request.getTo(), request.getCc(), request.getBcc(),
|
167 |
queueMailWithAttachments(request.getTo(), request.getCc(), request.getBcc(),
|
| 170 |
request.getSubject(), request.getBody(), request.isHtml(),
|
168 |
request.getSubject(), request.getBody(), request.isHtml(),
|