pioneer
2 years ago
commit
89fe08c18e
9 changed files with 547 additions and 0 deletions
@ -0,0 +1,7 @@
|
||||
# open-JSD-11714 |
||||
|
||||
JSD-11714 邮箱配置微软exchange邮箱服务器\ |
||||
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ |
||||
仅作为开发者学习参考使用!禁止用于任何商业用途!\ |
||||
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系【pioneer】处理。 |
||||
|
@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<project basedir="." default="jar" name="plugin-jsd-11714"> |
||||
<!-- JDK路径,根据自己机器上实际位置修改--> |
||||
<property name="jdk.home" value="C:\Program Files\Java\jdk1.8.0_152"/> |
||||
|
||||
<property name="libs" value="${basedir}/lib"/> |
||||
<property name="publicLibs" value=""/> |
||||
<property name="reportLibs" value="${basedir}/../webroot/WEB-INF/lib"/> |
||||
<property name="destLoc" value="."/> |
||||
<property name="classes" value="classes"/> |
||||
<xmlproperty file="${basedir}/plugin.xml"/> |
||||
<property name="current-version" value="${plugin.version}"/> |
||||
|
||||
<!-- 插件版本--> |
||||
<property name="plugin-version" value="${current-version}"/> |
||||
<!-- 插件名字--> |
||||
<property name="plugin-name" value="exchange-email-jsdbbhbe"/> |
||||
<property name="plugin-jar" value="fr-plugin-${plugin-name}-${plugin-version}.jar"/> |
||||
|
||||
<target name="prepare"> |
||||
<delete dir="${classes}"/> |
||||
<delete dir="fr-plugin-${plugin-name}-${plugin-version}"/> |
||||
<xmlproperty file="${basedir}/plugin.xml"/> |
||||
<delete dir="${destLoc}/${plugin.name}"/> |
||||
</target> |
||||
<path id="compile.classpath"> |
||||
<fileset dir="${libs}"> |
||||
<include name="**/*.jar"/> |
||||
</fileset> |
||||
<fileset dir="${publicLibs}"> |
||||
<include name="**/*.jar"/> |
||||
</fileset> |
||||
<fileset dir="${reportLibs}"> |
||||
<include name="**/*.jar"/> |
||||
</fileset> |
||||
</path> |
||||
<patternset id="resources4Jar"> |
||||
<exclude name="**/.settings/**"/> |
||||
<exclude name=".classpath"/> |
||||
<exclude name=".project"/> |
||||
|
||||
<exclude name="**/*.java"/> |
||||
<exclude name="**/*.db"/> |
||||
<exclude name="**/*.g"/> |
||||
<exclude name="**/package.html"/> |
||||
</patternset> |
||||
<target name="copy_resources"> |
||||
<echo message="从${resources_from}拷贝图片,JS,CSS等资源文件"/> |
||||
<delete dir="tmp"/> |
||||
<copy todir="tmp"> |
||||
<fileset dir="${resources_from}/src/main/resources"> |
||||
<patternset refid="resources4Jar"/> |
||||
</fileset> |
||||
</copy> |
||||
<copy todir="${classes}"> |
||||
<fileset dir="tmp"/> |
||||
</copy> |
||||
<delete dir="tmp"/> |
||||
</target> |
||||
<target name="compile_javas"> |
||||
<echo message="编译${compile_files}下的Java文件"/> |
||||
<javac destdir="${classes}" debug="false" optimize="on" source="${source_jdk_version}" |
||||
target="${target_jdk_version}" |
||||
fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}" |
||||
executable="${compile_jdk_version}/bin/javac"> |
||||
<src path="${basedir}/src/main/java"/> |
||||
<exclude name="**/.svn/**"/> |
||||
<compilerarg line="-encoding UTF8 "/> |
||||
<classpath refid="compile.classpath"/> |
||||
</javac> |
||||
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask"> |
||||
<classpath refid="compile.classpath"/> |
||||
</taskdef> |
||||
<pretreatment baseDir="${basedir}"/> |
||||
</target> |
||||
|
||||
<target name="jar_classes"> |
||||
<echo message="打Jar包:${jar_name}"/> |
||||
<delete file="${basedir}/${jar_name}"/> |
||||
<jar jarfile="${basedir}/${jar_name}"> |
||||
<fileset dir="${classes}"> |
||||
</fileset> |
||||
</jar> |
||||
</target> |
||||
|
||||
<target name="super_jar" depends="prepare"> |
||||
<antcall target="copy_resources"> |
||||
<param name="resources_from" value="${basedir}"/> |
||||
</antcall> |
||||
<antcall target="compile_javas"> |
||||
<param name="source_jdk_version" value="8"/> |
||||
<param name="target_jdk_version" value="8"/> |
||||
<param name="compile_jdk_version" value="${jdk.home}"/> |
||||
<param name="compile_files" value="${basedir}/src"/> |
||||
</antcall> |
||||
<echo message="compile plugin success!"/> |
||||
|
||||
<antcall target="jar_classes"> |
||||
<param name="jar_name" value="${plugin-jar}"/> |
||||
</antcall> |
||||
<delete dir="${classes}"/> |
||||
|
||||
</target> |
||||
|
||||
<target name="jar" depends="super_jar"> |
||||
<antcall target="zip"/> |
||||
</target> |
||||
|
||||
<target name="zip"> |
||||
<property name="plugin-folder" value="fr-plugin-${plugin-name}-${plugin-version}"/> |
||||
<echo message="----------zip files----------"/> |
||||
<mkdir dir="${plugin-folder}"/> |
||||
<copy todir="${plugin-folder}"> |
||||
<fileset dir="."> |
||||
<include name="${plugin-jar}"/> |
||||
<include name="plugin.xml"/> |
||||
</fileset> |
||||
<fileset dir="${libs}"> |
||||
<include name="*.jar"/> |
||||
<include name="*.dll"/> |
||||
</fileset> |
||||
</copy> |
||||
<zip destfile="${basedir}/${plugin-folder}.zip" basedir="."> |
||||
<include name="${plugin-folder}/*.jar"/> |
||||
<include name="${plugin-folder}/*.dll"/> |
||||
<include name="${plugin-folder}/plugin.xml"/> |
||||
</zip> |
||||
<move file="${plugin-folder}.zip" todir="${destLoc}/install"/> |
||||
</target> |
||||
</project> |
Binary file not shown.
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<plugin> |
||||
<id>com.fr.plugin.third.party.jsdbbhbe</id> |
||||
<name><![CDATA[微软exchange邮箱服务器发送邮件_EK]]></name> |
||||
<active>yes</active> |
||||
<version>1.0.1</version> |
||||
<env-version>10.0~11.0</env-version> |
||||
<jartime>2019-01-01</jartime> |
||||
<vendor>fr.open</vendor> |
||||
<description><![CDATA[]]></description> |
||||
<change-notes><![CDATA[ |
||||
[2023-02-08]JSD-11714插件初始化<br/> |
||||
]]></change-notes> |
||||
<extra-core> |
||||
<EmailServiceProvider class="com.fr.plugin.third.party.jsdbbhbe.email.ExchangeEmailService"/> |
||||
</extra-core> |
||||
<function-recorder class="com.fr.plugin.third.party.jsdbbhbe.config.DataConfigInitializeMonitor"/> |
||||
<lifecycle-monitor class="com.fr.plugin.third.party.jsdbbhbe.config.DataConfigInitializeMonitor"/> |
||||
</plugin> |
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<parent> |
||||
<groupId>com.fr.plugin</groupId> |
||||
<artifactId>starter</artifactId> |
||||
<version>10.0</version> |
||||
</parent> |
||||
<packaging>jar</packaging> |
||||
<artifactId>plugin-jsd-11714</artifactId> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.fanruan.api</groupId> |
||||
<artifactId>finekit</artifactId> |
||||
<version>10.0</version> |
||||
<scope>system</scope> |
||||
<systemPath>${project.basedir}/lib/finekit-10.0.jar</systemPath> |
||||
</dependency> |
||||
</dependencies> |
||||
<properties> |
||||
<!---如果要更改调试插件,改这里的配置就可以了--> |
||||
<plugin-path> |
||||
${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.third.party.jsd11714-1.0 |
||||
</plugin-path> |
||||
</properties> |
||||
<build> |
||||
<outputDirectory>${plugin-path}/classes</outputDirectory> |
||||
<resources> |
||||
<resource> |
||||
<targetPath>${plugin-path}</targetPath> |
||||
<directory>${project.basedir}</directory> |
||||
<includes> |
||||
<include>plugin.xml</include> |
||||
</includes> |
||||
</resource> |
||||
<resource> |
||||
<targetPath>${plugin-path}</targetPath> |
||||
<directory>${project.basedir}/lib</directory> |
||||
<includes> |
||||
<include>*.jar</include> |
||||
<include>*.dll</include> |
||||
</includes> |
||||
</resource> |
||||
</resources> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-compiler-plugin</artifactId> |
||||
<configuration> |
||||
<source>8</source> |
||||
<target>8</target> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
</project> |
@ -0,0 +1,10 @@
|
||||
package com.fr.plugin.third.party.jsdbbhbe; |
||||
|
||||
public class PluginConstant { |
||||
/** |
||||
* 插件ID |
||||
*/ |
||||
public static final String PLUGIN_ID = "com.fr.plugin.third.party.jsdbbhbe"; |
||||
|
||||
public static final String PLUGIN_TEXT = "plugin-jsdbbhbe"; |
||||
} |
@ -0,0 +1,55 @@
|
||||
package com.fr.plugin.third.party.jsdbbhbe.config; |
||||
|
||||
|
||||
import com.fr.config.*; |
||||
import com.fr.config.holder.Conf; |
||||
import com.fr.config.holder.factory.Holders; |
||||
|
||||
/** |
||||
* 配置数据保存 |
||||
*/ |
||||
@Visualization(category = "微软exchange邮箱服务器发送邮件配置") |
||||
public class DataConfig extends DefaultConfiguration { |
||||
public String getNameSpace() { |
||||
return this.getClass().getName(); |
||||
} |
||||
|
||||
private static volatile DataConfig config = null; |
||||
|
||||
public static DataConfig getInstance() { |
||||
if (config == null) { |
||||
config = ConfigContext.getConfigInstance(DataConfig.class); |
||||
} |
||||
return config; |
||||
} |
||||
|
||||
@Identifier(value = "authUserName", name = "认证用户名", description = "", status = Status.SHOW) |
||||
private Conf<String> authUserName = Holders.simple(""); |
||||
|
||||
@Identifier(value = "authPassword", name = "认证密码", description = "", status = Status.SHOW) |
||||
private Conf<String> authPassword = Holders.simple(""); |
||||
|
||||
public String getAuthUserName() { |
||||
return authUserName.get(); |
||||
} |
||||
|
||||
public void setAuthUserName(String authUserName) { |
||||
this.authUserName.set(authUserName); |
||||
} |
||||
|
||||
public String getAuthPassword() { |
||||
return authPassword.get(); |
||||
} |
||||
|
||||
public void setAuthPassword(String authPassword) { |
||||
this.authPassword.set(authPassword); |
||||
} |
||||
|
||||
@Override |
||||
public Object clone() throws CloneNotSupportedException { |
||||
DataConfig cloned = (DataConfig) super.clone(); |
||||
cloned.authUserName = (Conf<String>) authUserName.clone(); |
||||
cloned.authPassword = (Conf<String>) authPassword.clone(); |
||||
return cloned; |
||||
} |
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.fr.plugin.third.party.jsdbbhbe.config; |
||||
|
||||
import com.fr.intelli.record.Focus; |
||||
import com.fr.intelli.record.Original; |
||||
import com.fr.plugin.context.PluginContext; |
||||
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
||||
import com.fr.plugin.third.party.jsdbbhbe.PluginConstant; |
||||
import com.fr.record.analyzer.EnableMetrics; |
||||
|
||||
/** |
||||
* 配置信息初始化 |
||||
*/ |
||||
@EnableMetrics |
||||
public class DataConfigInitializeMonitor extends AbstractPluginLifecycleMonitor { |
||||
@Override |
||||
@Focus(id = PluginConstant.PLUGIN_ID, text = PluginConstant.PLUGIN_TEXT, source = Original.PLUGIN) |
||||
public void afterRun(PluginContext pluginContext) { |
||||
DataConfig.getInstance(); |
||||
} |
||||
|
||||
@Override |
||||
public void beforeStop(PluginContext pluginContext) { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,242 @@
|
||||
package com.fr.plugin.third.party.jsdbbhbe.email; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.config.EmailServerConfig; |
||||
import com.fr.plugin.context.PluginContexts; |
||||
import com.fr.plugin.third.party.jsdbbhbe.PluginConstant; |
||||
import com.fr.plugin.third.party.jsdbbhbe.config.DataConfig; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.email.EmailAttachmentProvider; |
||||
import com.fr.stable.fun.Authorize; |
||||
import com.fr.stable.fun.impl.AbstractEmailServiceProvider; |
||||
|
||||
import javax.activation.DataHandler; |
||||
import javax.mail.*; |
||||
import javax.mail.internet.*; |
||||
import java.util.Iterator; |
||||
import java.util.Map; |
||||
import java.util.Properties; |
||||
import java.util.UUID; |
||||
|
||||
@Authorize(callSignKey = PluginConstant.PLUGIN_ID) |
||||
public class ExchangeEmailService extends AbstractEmailServiceProvider { |
||||
|
||||
|
||||
/** |
||||
* 发送邮件 |
||||
* |
||||
* @param toAddress 收件人地址 |
||||
* @param ccAddress 抄送地址 |
||||
* @param bccAddress 密送地址 |
||||
* @param fromAddress 发件人地址 |
||||
* @param subject 主题 |
||||
* @param bodyContent 正文 |
||||
* @param attaches 附件 |
||||
* @param format 格式 |
||||
* @param contentAttaches 邮件正文显示的附件 |
||||
* @throws MessagingException 异常 |
||||
*/ |
||||
@Override |
||||
public void send(String toAddress, String ccAddress, String bccAddress, String fromAddress, String subject, String bodyContent, EmailAttachmentProvider[] attaches, String format, EmailAttachmentProvider[] contentAttaches) throws MessagingException { |
||||
LogKit.info("微软exchange邮箱服务器发送邮件,开始发送..."); |
||||
//添加认证
|
||||
LogKit.info("微软exchange邮箱服务器发送邮件,判断许可证"); |
||||
if (!PluginContexts.currentContext().isAvailable()) { |
||||
LogKit.error("微软exchange邮箱服务器发送邮件插件试用过期, 请添加许可证"); |
||||
return; |
||||
} |
||||
|
||||
LogKit.info("微软exchange邮箱服务器发送邮件,检查参数"); |
||||
String mailHost = EmailServerConfig.getInstance().getMailHost(); |
||||
String mailPort = EmailServerConfig.getInstance().getPort(); |
||||
String mailAccount = EmailServerConfig.getInstance().getFromEmailAddress(); |
||||
String mailPassword = EmailServerConfig.getInstance().getPassword(); |
||||
|
||||
String authUserName = DataConfig.getInstance().getAuthUserName(); |
||||
String authPassword = DataConfig.getInstance().getAuthPassword(); |
||||
if (StringKit.isEmpty(mailHost)) { |
||||
LogKit.info("微软exchange邮箱服务器发送邮件,邮件服务器地址为空"); |
||||
return; |
||||
} |
||||
if (StringKit.isEmpty(mailPort)) { |
||||
LogKit.info("微软exchange邮箱服务器发送邮件,邮件服务器端口为空"); |
||||
return; |
||||
} |
||||
if (StringKit.isEmpty(mailAccount)) { |
||||
LogKit.info("微软exchange邮箱服务器发送邮件,发件人地址为空"); |
||||
return; |
||||
} |
||||
if (StringKit.isEmpty(mailPassword)) { |
||||
LogKit.info("微软exchange邮箱服务器发送邮件,发件人密码为空"); |
||||
return; |
||||
} |
||||
if (StringKit.isEmpty(authUserName)) { |
||||
LogKit.info("微软exchange邮箱服务器发送邮件,认证用户名为空"); |
||||
return; |
||||
} |
||||
if (StringKit.isEmpty(authPassword)) { |
||||
LogKit.info("微软exchange邮箱服务器发送邮件,认证密码为空"); |
||||
return; |
||||
} |
||||
if (StringKit.isEmpty(toAddress)) { |
||||
LogKit.info("微软exchange邮箱服务器发送邮件,收件人地址为空"); |
||||
return; |
||||
} |
||||
|
||||
if (StringKit.isEmpty(format)) { |
||||
format = "utf-8"; |
||||
} |
||||
|
||||
|
||||
//配置发送邮件的环境属性
|
||||
Properties props = new Properties(); |
||||
// 表示SMTP发送邮件,需要进行身份验证
|
||||
props.put("mail.smtp.auth", "true"); |
||||
//props.put("mail.debug","true");
|
||||
props.put("mail.smtp.host", mailHost); |
||||
props.put("mail.smtp.port", mailPort); |
||||
//smtp登陆的账号、密码 ;需开启smtp登陆
|
||||
props.put("mail.user", mailAccount); |
||||
//访问SMTP服务时需要提供的密码,不是邮箱登陆密码,一般都有独立smtp的登陆密码
|
||||
props.put("mail.password", mailPassword); |
||||
props.put("mail.smtp.connectiontimeout", EmailServerConfig.getInstance().getSmtpConnectionTimeout()); |
||||
|
||||
|
||||
//构建授权信息,用于进行SMTP进行身份验证
|
||||
Authenticator authenticator = new Authenticator() { |
||||
@Override |
||||
protected PasswordAuthentication getPasswordAuthentication() { |
||||
// 用户名、密码
|
||||
return new PasswordAuthentication(authUserName, authPassword); |
||||
} |
||||
}; |
||||
|
||||
// 使用环境属性和授权信息,创建邮件会话
|
||||
Session mailSession = Session.getInstance(props, authenticator); |
||||
// 创建邮件消息
|
||||
MimeMessage message = new MimeMessage(mailSession); |
||||
//设置发件人
|
||||
InternetAddress form = new InternetAddress(mailAccount); |
||||
message.setFrom(form); |
||||
|
||||
// 设置收件人地址
|
||||
InternetAddress to = new InternetAddress(toAddress); |
||||
message.setRecipient(Message.RecipientType.TO, to); |
||||
|
||||
// 设置抄送地址
|
||||
if (StringKit.isNotEmpty(ccAddress)) { |
||||
InternetAddress cc = new InternetAddress(ccAddress); |
||||
message.setRecipient(Message.RecipientType.CC, cc); |
||||
} |
||||
// 设置密送地址
|
||||
if (StringKit.isNotEmpty(bccAddress)) { |
||||
InternetAddress bcc = new InternetAddress(bccAddress); |
||||
message.setRecipient(Message.RecipientType.BCC, bcc); |
||||
} |
||||
|
||||
// 设置邮件标题
|
||||
message.setSubject(encodeContent(subject, format)); |
||||
|
||||
MimeMultipart bodyMultipart = new MimeMultipart(); |
||||
addBodyContent(bodyMultipart, bodyContent, format, contentAttaches); |
||||
addAttaches(bodyMultipart, attaches, format); |
||||
|
||||
// 设置邮件的内容体
|
||||
message.setContent(bodyMultipart); |
||||
|
||||
// 发送邮件
|
||||
Transport.send(message); |
||||
LogKit.info("微软exchange邮箱服务器发送邮件,发送结束"); |
||||
} |
||||
|
||||
/** |
||||
* 添加正文内容 |
||||
* |
||||
* @param bodyMultipart |
||||
* @param bodyContent |
||||
* @param format |
||||
*/ |
||||
private void addBodyContent(MimeMultipart bodyMultipart, String bodyContent, String format, EmailAttachmentProvider[] contentAttaches) throws MessagingException { |
||||
if (StringKit.isEmpty(bodyContent)) { |
||||
bodyContent = ""; |
||||
} |
||||
bodyContent = bodyContent.replaceAll("\\n", "<br>"); |
||||
|
||||
String imageId = ""; |
||||
if (ArrayUtils.isNotEmpty(contentAttaches)) { |
||||
imageId = "templateImage" + UUID.randomUUID(); |
||||
for (int i = 0, max = contentAttaches.length - 1; i <= max; i++) { |
||||
bodyContent = bodyContent + "<br/> <img "; |
||||
bodyContent = bodyContent + generateTagStr("src", "\"cid:" + imageId + i + "\""); |
||||
bodyContent = bodyContent + generateTagStr(contentAttaches[i].getContentTags()); |
||||
bodyContent = bodyContent + ">"; |
||||
} |
||||
} |
||||
String contentType = "text/html;charset=" + format; |
||||
MimeBodyPart contentBodyPart = new MimeBodyPart(); |
||||
contentBodyPart.setContent(bodyContent, contentType); |
||||
bodyMultipart.addBodyPart(contentBodyPart); |
||||
if (ArrayUtils.isNotEmpty(contentAttaches)) { |
||||
for (int i = 0, max = contentAttaches.length - 1; i <= max; i++) { |
||||
addImagePart(bodyMultipart, contentAttaches[i], imageId + i); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void addImagePart(MimeMultipart bodyMultipart, EmailAttachmentProvider contentAttache, String imageId) throws MessagingException { |
||||
MimeBodyPart imageBodyPart = new MimeBodyPart(); |
||||
imageBodyPart.setDataHandler(new DataHandler(contentAttache.getByteArrayDataSource())); |
||||
imageBodyPart.setHeader("Content-ID", "<" + imageId + ">"); |
||||
imageBodyPart.setFileName(imageId + ".png"); |
||||
imageBodyPart.setDisposition("inline"); |
||||
bodyMultipart.addBodyPart(imageBodyPart); |
||||
} |
||||
|
||||
/** |
||||
* 添加附件 |
||||
* |
||||
* @param bodyMultipart |
||||
* @param attaches |
||||
* @throws MessagingException |
||||
*/ |
||||
private void addAttaches(MimeMultipart bodyMultipart, EmailAttachmentProvider[] attaches, String format) throws MessagingException { |
||||
if (ArrayUtils.isEmpty(attaches)) { |
||||
return; |
||||
} |
||||
EmailAttachmentProvider attache; |
||||
MimeBodyPart attacheBodyPart; |
||||
for (int i = 0, max = attaches.length - 1; i <= max; i++) { |
||||
attache = attaches[i]; |
||||
attacheBodyPart = new MimeBodyPart(); |
||||
attacheBodyPart.setDataHandler(new DataHandler(attache.getByteArrayDataSource())); |
||||
attacheBodyPart.setFileName(encodeContent(attache.getFileName(), format)); |
||||
bodyMultipart.addBodyPart(attacheBodyPart); |
||||
} |
||||
} |
||||
|
||||
private String encodeContent(String content, String format) { |
||||
try { |
||||
return MimeUtility.encodeText(content, format, "Q"); |
||||
} catch (Exception e) { |
||||
LogKit.error("微软exchange邮箱服务器发送邮件,字符串加密出错," + e.getMessage(), e); |
||||
return content; |
||||
} |
||||
} |
||||
|
||||
private String generateTagStr(Map<String, String> map) { |
||||
StringBuilder builder = new StringBuilder(); |
||||
if (map != null) { |
||||
Iterator iterator = map.entrySet().iterator(); |
||||
while (iterator.hasNext()) { |
||||
Map.Entry entry = (Map.Entry) iterator.next(); |
||||
builder.append(this.generateTagStr((String) entry.getKey(), (String) entry.getValue())); |
||||
} |
||||
} |
||||
return new String(builder); |
||||
} |
||||
|
||||
private String generateTagStr(String name, String value) { |
||||
return name + "=" + value + " "; |
||||
} |
||||
} |
Loading…
Reference in new issue