public class SmtpEmailSender extends java.lang.Object implements EmailSender
Modifier and Type | Class and Description |
---|---|
static class |
SmtpEmailSender.Module |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
buildMultipartBody(java.lang.String boundary,
java.lang.String textPart,
java.lang.String htmlPart) |
boolean |
canEmail(java.lang.String address)
Can the address receive messages from us?
|
static java.lang.String |
generateMultipartBoundary(java.lang.String textBody,
java.lang.String htmlBody) |
boolean |
isEnabled() |
protected java.lang.String |
quotedPrintableEncode(java.lang.String input) |
void |
send(com.google.gerrit.mail.Address from,
java.util.Collection<com.google.gerrit.mail.Address> rcpt,
java.util.Map<java.lang.String,com.google.gerrit.mail.EmailHeader> callerHeaders,
java.lang.String body)
Sends an email message with a text body only (i.e.
|
void |
send(com.google.gerrit.mail.Address from,
java.util.Collection<com.google.gerrit.mail.Address> rcpt,
java.util.Map<java.lang.String,com.google.gerrit.mail.EmailHeader> callerHeaders,
java.lang.String textBody,
java.lang.String htmlBody)
Sends an email message.
|
public boolean isEnabled()
isEnabled
in interface EmailSender
public boolean canEmail(java.lang.String address)
EmailSender
canEmail
in interface EmailSender
address
- the address to consider.public void send(com.google.gerrit.mail.Address from, java.util.Collection<com.google.gerrit.mail.Address> rcpt, java.util.Map<java.lang.String,com.google.gerrit.mail.EmailHeader> callerHeaders, java.lang.String body) throws com.google.gerrit.exceptions.EmailException
EmailSender
Authors of new implementations of this interface should not use this method to send a
message because this method does not accept the HTML body. Instead, authors should use the
above signature of send
.
This version of the method is preserved for support of legacy implementations.
send
in interface EmailSender
from
- who the message is from.rcpt
- one or more address where the message will be delivered to. This list overrides any
To or CC headers in headers
.callerHeaders
- message headers.body
- text to appear in the body of the message.com.google.gerrit.exceptions.EmailException
- the message cannot be sent.public void send(com.google.gerrit.mail.Address from, java.util.Collection<com.google.gerrit.mail.Address> rcpt, java.util.Map<java.lang.String,com.google.gerrit.mail.EmailHeader> callerHeaders, java.lang.String textBody, java.lang.String htmlBody) throws com.google.gerrit.exceptions.EmailException
EmailSender
send
should construct
a multipart/alternative
message with an appropriately-selected boundary.send
in interface EmailSender
from
- who the message is from.rcpt
- one or more address where the message will be delivered to. This list overrides any
To or CC headers in headers
.callerHeaders
- message headers.textBody
- text to appear in the text/plain
body of the message.htmlBody
- optional HTML code to appear in the text/html
body of the message.com.google.gerrit.exceptions.EmailException
- the message cannot be sent.public static java.lang.String generateMultipartBoundary(java.lang.String textBody, java.lang.String htmlBody) throws com.google.gerrit.exceptions.EmailException
com.google.gerrit.exceptions.EmailException
protected java.lang.String buildMultipartBody(java.lang.String boundary, java.lang.String textPart, java.lang.String htmlPart) throws java.io.IOException
java.io.IOException
protected java.lang.String quotedPrintableEncode(java.lang.String input) throws java.io.IOException
java.io.IOException