| 1 |
|
package com.atlassian.mail.queue; |
| 2 |
|
|
| 3 |
|
import com.atlassian.mail.Email; |
| 4 |
|
import com.atlassian.mail.MailException; |
| 5 |
|
import com.atlassian.mail.MailFactory; |
| 6 |
|
import com.atlassian.mail.server.SMTPMailServer; |
| 7 |
|
import org.apache.log4j.Category; |
| 8 |
|
|
| 9 |
|
import javax.mail.Multipart; |
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 7 |
Complexity Density: 0.47 |
|
| 18 |
|
public class SingleMailQueueItem extends AbstractMailQueueItem |
| 19 |
|
{ |
| 20 |
|
private static final Category log = Category.getInstance(SingleMailQueueItem.class); |
| 21 |
|
|
| 22 |
|
private Email email; |
| 23 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 24 |
0
|
public SingleMailQueueItem(Email email)... |
| 25 |
|
{ |
| 26 |
0
|
super(email.getSubject()); |
| 27 |
0
|
this.email = email; |
| 28 |
|
} |
| 29 |
|
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 5 |
Complexity Density: 0.42 |
|
| 30 |
0
|
public void send() throws MailException... |
| 31 |
|
{ |
| 32 |
0
|
incrementSendCount(); |
| 33 |
|
|
| 34 |
0
|
SMTPMailServer smtpMailServer = MailFactory.getServerManager().getDefaultSMTPMailServer(); |
| 35 |
|
|
| 36 |
0
|
if (smtpMailServer == null) |
| 37 |
|
{ |
| 38 |
0
|
log.debug("Not sending message as the default SMTP Mail Server is not defined."); |
| 39 |
0
|
return; |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
|
| 43 |
0
|
if (!MailFactory.isSendingDisabled()) |
| 44 |
|
{ |
| 45 |
|
|
| 46 |
0
|
if (mailThreader != null) mailThreader.threadEmail(email); |
| 47 |
0
|
smtpMailServer.send(email); |
| 48 |
0
|
if (mailThreader != null) mailThreader.storeSentEmail(email); |
| 49 |
|
} |
| 50 |
|
else |
| 51 |
|
{ |
| 52 |
0
|
log.debug("Not sending message as sending is turned off."); |
| 53 |
|
} |
| 54 |
|
} |
| 55 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
| 56 |
0
|
public String toString()... |
| 57 |
|
{ |
| 58 |
0
|
return (email != null ? email.toString() : "null"); |
| 59 |
|
} |
| 60 |
|
} |