public class EmailManager extends UniqueKey implements EmailManagerProvider
限定符和类型 | 类和说明 |
---|---|
static class |
EmailManager.DefaultEmailProcessor |
EMPTY
构造器和说明 |
---|
EmailManager() |
限定符和类型 | 方法和说明 |
---|---|
java.lang.Object |
clone()
克隆
|
JSONObject |
createJSON()
生成JSON数据
|
java.lang.String |
getEncryptionMethod()
返回SMTP加密方式,默认值 TLS
|
java.lang.String |
getFromEmailAddress()
返回发件人地址
|
static EmailManager |
getInstance()
构造函数
获取邮件管理类
|
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 |
readXML(XMLableReader reader)
读取xml对象
|
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)
设置邮箱用户名
|
void |
writeXML(XMLPrintWriter writer)
写入xml对象
|
copy, getId, getNameSpace, setId, setNameSpace
getClassInfo, getData, invalidate, isLoad, setClassInfo, setData
public static EmailManager getInstance()
public java.lang.String getPort()
getPort
在接口中 EmailManagerProvider
public void setPort(java.lang.String port)
setPort
在接口中 EmailManagerProvider
port
- SMTP端口public java.lang.String getEncryptionMethod()
getEncryptionMethod
在接口中 EmailManagerProvider
public void setEncryptionMethod(java.lang.String encryption)
setEncryptionMethod
在接口中 EmailManagerProvider
encryption
- SMTP加密方式public java.lang.String getMailHost()
getMailHost
在接口中 EmailManagerProvider
public void setMailHost(java.lang.String mailHost)
setMailHost
在接口中 EmailManagerProvider
mailHost
- SMTP地址public java.lang.String getUser()
getUser
在接口中 EmailManagerProvider
public void setUser(java.lang.String user)
setUser
在接口中 EmailManagerProvider
user
- 邮箱用户名public java.lang.String getPassword()
getPassword
在接口中 EmailManagerProvider
public void setPassword(java.lang.String password)
setPassword
在接口中 EmailManagerProvider
password
- 密码public java.lang.String getFromEmailAddress()
getFromEmailAddress
在接口中 EmailManagerProvider
public void setFromEmailAddress(java.lang.String fromEmailAddress)
setFromEmailAddress
在接口中 EmailManagerProvider
fromEmailAddress
- 发件人地址public boolean isEmailConfigValid()
isEmailConfigValid
在接口中 EmailManagerProvider
public void sendTestMail(java.lang.String toAddress, java.util.Locale locale) throws javax.mail.MessagingException
sendTestMail
在接口中 EmailManagerProvider
toAddress
- 收件人地址locale
- 语言偏好javax.mail.MessagingException
- 异常public 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");
send
在接口中 EmailManagerProvider
toAddress
- 收件人地址subject
- 主题bodyContent
- 内容javax.mail.MessagingException
- 异常public void send(java.lang.String toAddress, java.lang.String subject, java.lang.String bodyContent, java.lang.String format) throws javax.mail.MessagingException
send
在接口中 EmailManagerProvider
toAddress
- 收件人地址subject
- 主题bodyContent
- 内容format
- 格式javax.mail.MessagingException
- 异常public 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
send
在接口中 EmailManagerProvider
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址subject
- 主题bodyContent
- 内容attaches
- 附件javax.mail.MessagingException
- 异常public 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
send
在接口中 EmailManagerProvider
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址fromAddress
- 发件人地址subject
- 主题bodyContent
- 正文内容attaches
- 附件contentAttaches
- 邮件正文附件javax.mail.MessagingException
- 异常public 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
EmailManagerProvider
send
在接口中 EmailManagerProvider
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址fromAddress
- 发件人地址subject
- 主题bodyContent
- 正文内容attaches
- 附件contentAttaches
- 邮件正文附件sessionID
- sessionIDjavax.mail.MessagingException
- 异常public 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
EmailManagerProvider
send
在接口中 EmailManagerProvider
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址fromAddress
- 发件人地址subject
- 主题bodyContent
- 正文attaches
- 附件format
- 格式contentAttaches
- 邮件正文显示的附件javax.mail.MessagingException
- 异常public 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
send
在接口中 EmailManagerProvider
toAddress
- 收件人地址ccAddress
- 抄送地址bccAddress
- 密送地址fromAddress
- 发件人地址subject
- 主题bodyContent
- 正文attaches
- 附件format
- 格式contentAttaches
- 邮件正文显示的附件sessionID
- sessionIDjavax.mail.MessagingException
- 异常public void resetMailProperties()
resetMailProperties
在接口中 EmailManagerProvider
public JSONObject createJSON() throws JSONException
createJSON
在接口中 JSONCreator
JSONException
- 异常public void writeXML(XMLPrintWriter writer)
public void readXML(XMLableReader reader)
readXML
在接口中 XMLReadable
reader
- XML读取对象XMLableReader
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
在接口中 FCloneable
clone
在类中 UniqueKey
java.lang.CloneNotSupportedException
- 如果克隆失败则抛出此异常