Commit bcbd853a by 穆龙飞

modify:修改邮件发送逻辑

parent 32bd30ef
......@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.netease.mail.yanxuan.change.integration.email.service.UasClientService;
import com.netease.mail.yanxuan.change.integration.flow.email.EmailRpcService;
import com.netease.mail.yanxuan.change.integration.rpc.EncodeUtil;
import com.sun.deploy.net.URLEncoder;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
......@@ -38,9 +39,16 @@ public class UasClientServiceImpl implements UasClientService {
params.put("cc", StringUtils.join(ccList, ","));
}
logger.info(JSONObject.toJSONString("邮箱接口入参 subject={},content={},toList={},ccList={}"), subject, content, StringUtils.join(toList, ","), params.get("cc"));
String appendStr = "subject=" + subject + "&to=" + StringUtils.join(toList, ",") + "&cc=" + params.get("cc") + "&content=" + content;
String encode = EncodeUtil.encode(appendStr);
String res = service.sendEmail(encode);
String appendStr = null;
try {
appendStr = "subject=" + URLEncoder.encode(subject, "UTF-8")
+ "&to=" + URLEncoder.encode(StringUtils.join(toList, ","), "UTF-8")
+ "&cc=" + URLEncoder.encode(params.get("cc"), "UTF-8")
+ "&content=" + URLEncoder.encode(content, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String res = service.sendEmail(appendStr);
this.logger.info("[op:sendEmail] res={} ", res);
JSONObject jsonObject = JSON.parseObject(res);
if (jsonObject.getInteger("code") != 200) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment