public interface EmailManagerProvider extends JSONCreator, XMLable
限定符和类型 | 字段和说明 |
---|---|
static EmailManagerProvider |
EMPTY |
限定符和类型 | 方法和说明 |
---|---|
java.lang.String |
getEncryptionMethod()
返回SMTP加密方式,默认值 TLS
|
java.lang.String |
getFromEmailAddress()
返回发件人地址
|
java.lang.String |
getMailHost()
返回邮箱SMTP地址,类似smtp.163.com
|
java.lang.String |
getPassword()
返回邮箱密码
|
java.lang.String |
getPort()
返回SMTP端口,默认值25
|
java.lang.String |
getUser()
返回邮箱用户名
|
boolean |
isEmailConfigValid()
邮件配置合法检查。
|
void |
resetMailProperties()
滞空properties,防止平台重新配置邮件信息后,预览报表发邮件没更新
|
void |
send(java.lang.String toAddress,
java.lang.String subject,
java.lang.String bodyContent)
发送邮件
一个配置邮件并发送的例子:
EmailManager em = EmailManager.getInstance();
em.setMailHost("smtp.qq.com");
em.setUser("username@qq.com");
em.setPassword("password");
em.setFromEmailAddress("username@qq.com");
em.send("shockway@qq.com", "title", "content");
|
void |
send(java.lang.String toAddress,
java.lang.String subject,
java.lang.String bodyContent,
java.lang.String format)
发送邮件
|
void |
send(java.lang.String toAddress,
java.lang.String ccAddress,
java.lang.String bccAddress,
java.lang.String subject,
java.lang.String bodyContent,
EmailAttachment[] attaches)
发送邮件
|
void |
send(java.lang.String toAddress,
java.lang.String ccAddress,
java.lang.String bccAddress,
java.lang.String fromAddress,
java.lang.String subject,
java.lang.String bodyContent,
EmailAttachment[] attaches,
EmailAttachment[] contentAttaches)
发送邮件
|
void |
send(java.lang.String toAddress,
java.lang.String ccAddress,
java.lang.String bccAddress,
java.lang.String fromAddress,
java.lang.String subject,
java.lang.String bodyContent,
EmailAttachment[] attaches,
EmailAttachment[] contentAttaches,
java.lang.String sessionID)
发送邮件
|
void |
send(java.lang.String toAddress,
java.lang.String ccAddress,
java.lang.String bccAddress,
java.lang.String fromAddress,
java.lang.String subject,
java.lang.String bodyContent,
EmailAttachment[] attaches,
java.lang.String format,
EmailAttachment[] contentAttaches)
发送邮件
|
void |
send(java.lang.String toAddress,
java.lang.String ccAddress,
java.lang.String bccAddress,
java.lang.String fromAddress,
java.lang.String subject,
java.lang.String bodyContent,
EmailAttachment[] attaches,
java.lang.String format,
EmailAttachment[] contentAttaches,
java.lang.String sessionID)
发送邮件
|
void |
sendTestMail(java.lang.String toAddress,
java.util.Locale locale)
发送测试邮件
|
void |
setEncryptionMethod(java.lang.String encryption)
设置SMTP加密方式
|
void |
setFromEmailAddress(java.lang.String fromEmailAddress)
设置发件人地址
|
void |
setMailHost(java.lang.String mailHost)
设置邮箱SMTP地址,转换smtp为大写
|
void |
setPassword(java.lang.String password)
设置邮箱密码
|
void |
setPort(java.lang.String port)
设置SMTP端口
|
void |
setUser(java.lang.String user)
设置邮箱用户名
|
createJSON
readXML
clone
static final EmailManagerProvider EMPTY
java.lang.String getPort()
void setPort(java.lang.String port)
port
- SMTP端口java.lang.String getEncryptionMethod()
void setEncryptionMethod(java.lang.String encryption)
encryption
- SMTP加密方式java.lang.String getMailHost()
void setMailHost(java.lang.String mailHost)
mailHost
- SMTP地址java.lang.String getUser()
void setUser(java.lang.String user)
user
- 邮箱用户名java.lang.String getPassword()
void setPassword(java.lang.String password)
password
- 密码java.lang.String getFromEmailAddress()
void setFromEmailAddress(java.lang.String fromEmailAddress)
fromEmailAddress
- 发件人地址boolean isEmailConfigValid()
void sendTestMail(java.lang.String toAddress, java.util.Locale locale) throws javax.mail.MessagingException
toAddress
- 收件人地址locale
- 语言偏好javax.mail.MessagingException
- 异常void send(java.lang.String toAddress, java.lang.String subject, java.lang.String bodyContent) throws javax.mail.MessagingException
一个配置邮件并发送的例子:
EmailManager em = EmailManager.getInstance(); em.setMailHost("smtp.qq.com"); em.setUser("username@qq.com"); em.setPassword("password"); em.setFromEmailAddress("username@qq.com"); em.send("shockway@qq.com", "title", "content");
toAddress
- 收件人地址subject
- 主题bodyContent
- 内容javax.mail.MessagingException
- 异常void send(java.lang.String toAddress, java.lang.String subject, java.lang.String bodyContent, java.lang.String format) throws javax.mail.MessagingException
toAddress
- 收件人地址subject
- 主题bodyContent
- 内容format
- 格式javax.mail.MessagingException
- 异常void send(java.lang.String toAddress, java.lang.String ccAddress, java.lang.String bccAddress, java.lang.String subject, java.lang.String bodyContent, EmailAttachment[] attaches) throws javax.mail.MessagingException
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址subject
- 主题bodyContent
- 内容attaches
- 附件javax.mail.MessagingException
- 异常void send(java.lang.String toAddress, java.lang.String ccAddress, java.lang.String bccAddress, java.lang.String fromAddress, java.lang.String subject, java.lang.String bodyContent, EmailAttachment[] attaches, EmailAttachment[] contentAttaches) throws javax.mail.MessagingException
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址fromAddress
- 发件人地址subject
- 主题bodyContent
- 正文内容attaches
- 附件contentAttaches
- 邮件正文附件javax.mail.MessagingException
- 异常void send(java.lang.String toAddress, java.lang.String ccAddress, java.lang.String bccAddress, java.lang.String fromAddress, java.lang.String subject, java.lang.String bodyContent, EmailAttachment[] attaches, EmailAttachment[] contentAttaches, java.lang.String sessionID) throws javax.mail.MessagingException
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址fromAddress
- 发件人地址subject
- 主题bodyContent
- 正文内容attaches
- 附件contentAttaches
- 邮件正文附件sessionID
- sessionIDjavax.mail.MessagingException
- 异常void send(java.lang.String toAddress, java.lang.String ccAddress, java.lang.String bccAddress, java.lang.String fromAddress, java.lang.String subject, java.lang.String bodyContent, EmailAttachment[] attaches, java.lang.String format, EmailAttachment[] contentAttaches) throws javax.mail.MessagingException
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址fromAddress
- 发件人地址subject
- 主题bodyContent
- 正文attaches
- 附件format
- 格式contentAttaches
- 邮件正文显示的附件javax.mail.MessagingException
- 异常void send(java.lang.String toAddress, java.lang.String ccAddress, java.lang.String bccAddress, java.lang.String fromAddress, java.lang.String subject, java.lang.String bodyContent, EmailAttachment[] attaches, java.lang.String format, EmailAttachment[] contentAttaches, java.lang.String sessionID) throws javax.mail.MessagingException
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址fromAddress
- 发件人地址subject
- 主题bodyContent
- 正文attaches
- 附件format
- 格式contentAttaches
- 邮件正文显示的附件sessionID
- sessionIDjavax.mail.MessagingException
- 异常void resetMailProperties()