package com.yeshi.buwan.controller; import java.io.PrintWriter; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.yeshi.buwan.util.email.MailSenderUtil; import net.sf.json.JSONObject; @Controller @RequestMapping("email") public class EmailController { /** * 邮件发送 * * @param fromAccount * 源账户名 * @param fromPwd * 源密码 * @param toAccount * 目标账号 * @param title * 标题 * @param content * 内容 * @param res * @param request */ @RequestMapping(value = "sendEmail") public void acFunVideo(String fromAccount, String fromPwd, String toAccount, String title, String content, PrintWriter out) { boolean isS = MailSenderUtil.sendEmail(toAccount, fromAccount, fromPwd, title, content); JSONObject data = new JSONObject(); if (isS) { data.put("code", 0); } else { data.put("code", 1); data.put("msg", "邮件发送失败"); } out.print(data.toString()); } }