java 邮件,本地测试可以发送,放到云服务器上发送失败什么原因 1C

系统邮件发送本来是好的,在本地测试或者内网测试都可以收到邮件,但是把项目放到
云服务器上,邮件老是发送失败,这是怎么回事???和网络有关系么,首先我确定在我本地测试是没有这个错误信息的,邮件可以发送成功,网上搜了也没有搜到,请求各路神仙帮助

 2017-03-08 14:54:51,563 ERROR [io.undertow.request] (default task-9) UT005023: Exception handling request to /plugin/ckfinder/core/connector/java/connector.java: java.lang.IllegalStateException: UT010006: Cannot call getWriter(), getOutputStream() already called
    at io.undertow.servlet.spec.HttpServletResponseImpl.getWriter(HttpServletResponseImpl.java:344) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.spec.HttpServletResponseImpl.doErrorDispatch(HttpServletResponseImpl.java:156) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:264) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_121]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_121]

2个回答

有俩包冲突了,但是我忘了

q80088281
前方高能啦啦啦 回复旋转的钢笔: 楼主知道是哪两个包冲突了么?或者是什么别的问题导致的?
大约 2 年之前 回复
apbbbbb
旋转的钢笔 3q,我排查一下吧
2 年多之前 回复
apbbbbb
旋转的钢笔 。。。
2 年多之前 回复

是不是你的jar包管理问题,没有打包完全上去导致函数调用出错。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
java 发送本地邮件代码
发送邮件的代码和jar包 ,解压之后 ,导入自己的工程直接使用即可
为什么wince上发送hotmail的邮件失败,别的邮件测试可以是可以发送成功的;电脑端上测试软件测试的hotmail邮件是可以发送成功的
电脑端软件截图[img=https://img-bbs.csdn.net/upload/201808/21/1534831846_589484.png][/img]rnrn电脑端测试软件的主要代码 rnprivate void btnSend_Click_1(object sender, EventArgs e)rn rn rn tryrn rn //确定smtp服务器地址。实例化一个Smtp客户端rn System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(txt_Smtp.Text, Convert.ToInt32(txt_prot.Text));rnrn //构造一个发件人地址对象rn MailAddress from = new MailAddress(txtUserName.Text, txt_prot.Text, Encoding.UTF8);rn //构造一个收件人地址对象rn MailAddress to = new MailAddress(txtEmail.Text, txtToName.Text, Encoding.UTF8);rnrn //构造一个Email的Message对象rn MailMessage message = new MailMessage(from, to);rn//设置邮件的信息rn client.DeliveryMethod = SmtpDeliveryMethod.Network;rn message.BodyEncoding = System.Text.Encoding.UTF8;rn message.IsBodyHtml = false;rnrn //设置用户名和密码。rn //string userState = message.Subject;rn client.UseDefaultCredentials =false;rn string username = txtUserName.Text;rn string passwd = txtPassword.Text;rn //用户登陆信息rn NetworkCredential myCredentials = new NetworkCredential(username, passwd); rn client.Credentials = myCredentials;rn if (txt_prot.Text == "25")rn rn //关闭证书验证rn ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) return true; ;rn client.EnableSsl = false;rn rn elsern rn client.EnableSsl = true;rn rn client.Send(message);rnrnrn部署wince中的主要代码rn public void SendTest(string emailmessage)rn rn tryrn rn this.FullKeyboard.Visible = false;rn this.symbolKeyboard1.Visible = false;rn string smtp = txt_Send.Text;rn string domain = smtp.Substring(smtp.IndexOf('@') + 1);rn string host = "smtp." + domain;rn Int32 Port = 0;rn switch (domain)rn rn case "gmail.com":rnrn Port = 465;rn break;rn case "hotmail.com":rn host = "smtp-mail.outlook.com";rn Port = 587;rn break;rnrn default:rn Port = 25;rn break;rn rn //确定smtp服务器地址。实例化一个Smtp客户端rn OpenNETCF.Net.Mail.SmtpClient client = new OpenNETCF.Net.Mail.SmtpClient(host, Port);rnrnrn //构造一个发件人地址对象rn MailAddress from = new MailAddress(txt_Send.Text);rnrn //构造一个收件人地址对象rn MailAddress to = new MailAddress(txt_ToEmail.Text);rnrn //构造一个Email的Message对象rn MailMessage message = new MailMessage(from, to);rn //设置邮件内容rnrn message.Body = Convert.ToString(emailmessage);rn message.BodyEncoding = Encoding.UTF8;rn rn rn //设置邮件的信息rn client.DeliveryMethod = SmtpDeliveryMethod.Network;rn message.BodyEncoding = System.Text.Encoding.UTF8;rn message.IsBodyHtml = false;rnrn //用户登陆信息rn string username = txt_Send.Text;rn string passwd = txt_SendPwd.Text;rnrn SmtpCredential myCredentials = new SmtpCredential(username, passwd, domain);rn client.Credentials = myCredentials;rn rn client.Send(message);rn
PHPMailer 在本地发送成功 阿里云上发送失败原因
阿里云默认不允许访问SMTP 25端口,可申请解封25端口或换ssl加密方式连接和端口 已腾讯企业邮箱为例: $mail = new PHPMailer(); $mail->IsSMTP(); # $mail->Host = 'smtp.exmail.qq.com'; # 本地可直接使用 $mail->Host = 'ssl://smtp...
阿里云企业邮箱发送邮件失败,在本地测试可行,在云服务器上失败
最近公司有个业务,让我做一个发邮件的功能,前端传信息给后端,然后让我直接把信息传到某企业邮箱上去,本人用阿里云企业邮箱做好功能之后在本地测试没有问题,但是上传到公司服务器之后却一直显示错误。 找到服务器日志查看了之后发现错误是 smtp.mxhichina.com port25 出了问题,自己研究许久无果,上百度搜到的解答都是说企业邮箱的25端口屏蔽了。 遂用了QQ邮箱,经前辈指点,完成功能,亲测...
邮件连续多次发送失败
在发送邮件的时候时间间隔长一点没有问题,如果是连续多次发送就不行了rn有如下异常:rnSending failed;rn nested exception is:rn class javax.mail.MessagingException: 554 Remote Return: 450 : Data command rejected: Try again 2 minutes laterrnrn at javax.mail.Transport.send0(Transport.java:218)rn at javax.mail.Transport.send(Transport.java:80)rnrn程序是这样:rnpublic boolean send()rn try rn Properties props = new Properties();rn Session sendMailSession;rn props.put("mail.smtp.auth","true");rn props.put("mail.smtp.host", smtpServer); //smtp主机名rn props.put("mail.smtp.user",address); //发送方邮件地址rn props.put("mail.smtp.password",password); //邮件密码rn PopupAuthenticator popA=new PopupAuthenticator();//邮件安全认证rn popA.performCheck(username,password); //填写用户名及密码rn sendMailSession = Session.getInstance(props, popA);rn Message newMessage = new MimeMessage(sendMailSession);rn newMessage.setFrom(new InternetAddress(address));rn newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(takeAddress)); //接收方邮件地址rn newMessage.setSubject(title);rn newMessage.setSentDate(new Date());rn newMessage.setText(text); //邮件正文rn Transport.send(newMessage);rn rn return true;rn rn catch (MessagingException ex)rn rn ex.printStackTrace();rn return false;rn rn
activiti邮件任务发送失败
[img=https://img-bbs.csdn.net/upload/201802/28/1519805832_265475.png][/img][img=https://img-bbs.csdn.net/upload/201802/28/1519805934_345662.png][/img]rnrnrn我使用springboot集成activiti,邮件任务,总是提示邮件发送失败,哪路大神用过这个。javax.mail.AuthenticationFailedException: 535 Error: ÇëʹÓÃÊÚȨÂëµÇ¼¡£ÏêÇéÇë¿
获取发送失败邮件的信息
现在遇到一个难解决的问题,我想获取发送失败邮件的信息,一般情况下邮件发送出去以后我只能确认我的邮件通过邮件程序发送出去成功,但是现在如果我写了一个不存在的邮件地址我本地获得的是发送成功,但是我还想知道这个邮件是发送失败状态也就是这个邮件地址不存在,我应该如何获得错误信息呢!请高手指点一下这个问题应该怎么解决!!
邮件的发送,在本地可以,传到租用的服务器上就不行了?????????
邮件的发送,在本地可以,传到租用的服务器上就不行了rnrn提示错误:Trying to smtp.163.com:25 Error: Cannot connenct to relay host smtp.163.com rnrn中文好啊";//邮件内容rn$mailtype = "HTML";//邮件格式(HTML/TXT),TXT为文本邮件rn##########################################rn$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//这里面的一个true是表示使用身份验证,否则不使用身份验证.rn$smtp->debug = true;//是否显示发送的调试信息rnif ($smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype))rn echo "邮件发送成功";rnelsern echo "邮件发送失败";rn?>rnrnrn
阿里云发送SMTP邮件失败
阿里云发送SMTP邮件失败。System.Net.WebException: 无法连接到远程服务器 ---> System.Net.Sockets.SocketException: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
发送带附件的邮件失败?
代码如下:rnrnpublic partial class SendMail : System.Web.UI.Pagernrn private string path="";rnrn protected void Page_Load(object sender, EventArgs e)rn rn path = @"~/attachment.xls";rnrn path = Server.MapPath(path);rnrn bool result = SendEmail(path);rnrn Response.Write(result);rn rnrnrn public static bool SendEmail(string path)rn rn bool isSend = false;rnrn System.Web.Mail.MailMessage objMailMessage = new System.Web.Mail.MailMessage();rnrn objMailMessage.From = "cs@***.cc";rn rn objMailMessage.Cc = "***@qq.com;**@21cn.com";rn objMailMessage.To = "***@qq.com;**@21cn.com";rn objMailMessage.Subject = "Test mail";rn rn objMailMessage.BodyFormat = MailFormat.Html;rn objMailMessage.Body = "this is test message.";rnrn objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");rn objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "****");rn objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "****");rnrn SmtpMail.SmtpServer = "mail.***.cc";rnrn if (!string.IsNullOrEmpty(path))rn rn string[] pathArray = path.Split(',');rn Attachment data;rn ContentDisposition disposition;rn for (int i = 0; i < pathArray.Length; i++)rn rn data = new Attachment(pathArray[i], MediaTypeNames.Application.Octet);//实例化附件 rn disposition = data.ContentDisposition;rn disposition.CreationDate = System.IO.File.GetCreationTime(pathArray[i]);//获取附件的创建日期 rn disposition.ModificationDate = System.IO.File.GetLastWriteTime(pathArray[i]);//获取附件的修改日期 rn disposition.ReadDate = System.IO.File.GetLastAccessTime(pathArray[i]);//获取附件的读取日期rnrn objMailMessage.Attachments.Add(data);//添加到附件中rn rn rnrnrn tryrn rn SmtpMail.Send(objMailMessage);rn isSend = true;rnrn rn catch (Exception e)rn rn return isSend;rn rnrn return isSend;rn rnrnrnrn提交后..打印出来的result为false..为什么? 如果不带附件path为空的时候..能正常发送..
java mail本地测试发送批量邮件部分成功 部分失败,失败的没有异常提示
public class CheckAndSend rnrn private static Logger logger = Logger.getLogger(CheckAndSend.class);rn private static MailContent cotent = new MailContent();// 邮件内容模板rn private static List to = new ArrayList();// 此集合为邮件目标发送人员信息rn private static Map config = PropertyUtil.getProMap();// 从config.properties配置文件里读取带参数的对象rnrn public void checkAndSend() throws Exception rn String dueDate;rn int[] temp = 14 ;rn for (int j = 0; j < temp.length; j++) rn dueDate = "day" + temp[j];rn logger.info("enter method CheckAndSend,dueDate=" + dueDate);rn List li = getDueList(dueDate);rn if (!li.isEmpty()) rn for (int i = 0; i < li.size(); i++) rn Map map = (Map) li.get(i);rn System.out.println("----------------------"+map.toString());rn sendEmail(dueDate, map);rn rn rn rn logger.info("exit method CheckAndSend");rn rnrn private void sendEmail(String dueDate, Map map) rn // 根据获得信息并处理,去调用send方法发送邮件rn logger.info("enter method sendEmail,dueDate=" + dueDate + ",map=" + map);rn String co = cotent.getMailContent(map);rn to.clear();rn to.add(map.get("domain_name") + "@cn.fujitsu.com");rn String str = config.get("SUBJECT").toString();rn boolean bo = MailSend.send(config, str, (ArrayList) to, co, "00");rn if (bo == false) rn logger.error("sendEmail方法发送邮件出现异常!用户:" + map.get("domaimn_name")rn + "距到期时间" + dueDate);rn MailSendError.sendError("sendEmail方法发送邮件出现异常!用户:"rn + map.get("domaimn_name") + "距到期时间" + dueDate);rn rn logger.info("exit method sendEmail");rn rnrn private List getDueList(String due) throws Exception rn // 从数据库获取即将到期用户相关信息,并用map存储rn logger.info("enter method getDueList,due=" + due);rn Connection conn = JFinalUtil.getConn();rn PreparedStatement ps = null;rn ResultSet rs = null;rn List lst = new ArrayList();rn String sql = null;rn String check = null;rn sql = "select DISTINCT IFNULL(concat(e.family_name,', ',e.given_name,'/',e.c_family_name,' ',e.c_given_name),e.domain_name) as name,el.end_date,e.domain_name "rn + "from employee_lync el "rn + "left join employee e "rn + "on e.domain_name = el.domain_name where Date_ADD(el.end_date,INTERVAL -130 DAY)=date(now()); ";rn logger.info("查询相差" + due.substring(3) + "天");rn ps = conn.prepareStatement(sql);rn rs = ps.executeQuery();rn while (rs.next()) rn Map map = new HashMap();rn check = checkUser(rs.getString(3), "checkUser");rn if ("0".equals(check)) rn logger.info(rs.getString(3) + "用户信息验证存在.");rn map.put("name", rs.getString(1));rn map.put("end_date", rs.getString(2));rn map.put("domain_name", rs.getString(3));rn map.put("due", due.substring(3));rn lst.add(map);rn rn if ("1".equals(check)) rn logger.info("用户:" + rs.getString(3) + "不存在,请核实:");rn rn if ("-2".equals(check)) rn logger.info("用户:" + rs.getString(3) + "验证不通过,请核实:");rn rn rn rs.close();rn ps.close();rn conn.close();rn logger.info("exit method getDueList,lst=" + lst);rn return lst;rn rnrn private static String checkUser(String string, String methodName) rn String rtnCode = "";rn try rn // 调用checkUser接口验证rn String company = PropertyUtil.getProperty("company");rn String key = PropertyUtil.getProperty("key");rn String params = "userName=" + string + "&company=" + company;rn String sign = MD5Util.md5Hex(params + key).substring(0, 16)rn .toUpperCase();rn String url = PropertyUtil.getProperty("apiUrl") + methodName;rn url += "?" + params + "&sign=" + sign;rn String userCheck = Client.getConnAndExecMethod(HttpMethods.GET,rn url, null);rn JSONObject json;rn if (userCheck != null && userCheck.length() > 0rn && userCheck.charAt(0) == 'v') rn userCheck = userCheck.substring(14, 29);rn json = new JSONObject(userCheck);rn rtnCode = json.getString("rtnCode");rn logger.info("用户" + string + "调用checkUser接口返回值为:" + rtnCode);rn return rtnCode;rn else rn logger.error(url + "\n the return of the method " + methodNamern + " is " + userCheck + "\n");rn rn catch (Exception e) rn logger.error(e.getMessage(), e);rn rn return rtnCode;rn rnrnrnrnrnpublic class MailSend rn /**rn * 以文本格式发送邮件rn * rn * @param mailInforn * 待发送的邮件的信息rn */rn private static Logger logger = Logger.getLogger(MailSend.class);rnrn public boolean sendTextMail(MailUserInfo mailInfo) rn MailAuth authenticator = null;rn Properties pro = mailInfo.getProperties();rn if (mailInfo.isValidate()) rn authenticator = new MailAuth(mailInfo.getUserName(),rn mailInfo.getPassword());rn rn Session sendMailSession = Sessionrn .getDefaultInstance(pro, authenticator);rn try rn Message mailMessage = new MimeMessage(sendMailSession);rn Address from = new InternetAddress(mailInfo.getFromAddress());rn mailMessage.setFrom(from);rn Address[] to = mailInfo.getToAddress();rn mailMessage.addRecipients(Message.RecipientType.TO, to);rn mailMessage.setSubject(mailInfo.getSubject());rn mailMessage.setSentDate(new Date());rn String mailContent = mailInfo.getContent();rn mailMessage.setText(mailContent);rn Transport.send(mailMessage);rn System.out.println("---------------------------"+mailMessage.toString());rn return true;rn catch (MessagingException ex) rn logger.error(ex.getMessage(), ex);rn rn return false;rn rnrn /**rn * 以HTML格式发送邮件rn * rn * @param mailInforn * 待发送的邮件信息rn */rn @SuppressWarnings("rawtypes")rn public boolean sendHtmlMail(MailUserInfo mailInfo) rn MailAuth authenticator = null;rn Properties pro = mailInfo.getProperties();rn if (mailInfo.isValidate()) rn authenticator = new MailAuth(mailInfo.getUserName(),rn mailInfo.getPassword());rn rn Session sendMailSession = Sessionrn .getDefaultInstance(pro, authenticator);rn try rn Message mailMessage = new MimeMessage(sendMailSession);rn Address from = new InternetAddress(mailInfo.getFromAddress());rn mailMessage.setFrom(from);rn Address[] to = mailInfo.getToAddress();rn mailMessage.setRecipients(Message.RecipientType.TO, to);rn mailMessage.setSubject(mailInfo.getSubject());rn mailMessage.setSentDate(new Date());rn Multipart mainPart = new MimeMultipart();rn BodyPart html = new MimeBodyPart();rn html.setContent(mailInfo.getContent(), "text/html; charset=utf-8");rn mainPart.addBodyPart(html);rn mailMessage.setContent(mainPart);rn ArrayList files = new ArrayList();rn files = mailInfo.getFilesName();rn for (int i = 0; i < files.size(); i++) rn html = new MimeBodyPart();rn String filename = (String) files.get(i);rn FileDataSource fds = new FileDataSource(filename);rn html.setDataHandler(new DataHandler(fds)); // 得到附件本身并至入BodyPartrn html.setFileName(fds.getName()); // 得到文件名同样至入BodyPartrn mainPart.addBodyPart(html);rn rn // 发送邮件rn Transport.send(mailMessage);rn return true;rn catch (MessagingException ex) rn logger.error(ex.getMessage(), ex);rn rn return false;rn rnrn public static void send(String content, String subject, Object files,rn List toAddress) rn // 这个类主要是设置邮件rn MailUserInfo mailInfo = new MailUserInfo();rnrn mailInfo.setMailServerHost((String) PropertyUtilrn .getProperty("mail_host"));rn mailInfo.setMailServerPort((String) PropertyUtilrn .getProperty("mail_port"));rn mailInfo.setValidate(Boolean.getBoolean((String) PropertyUtilrn .getProperty("mail_validate")));rn mailInfo.setUserName((String) PropertyUtil.getProperty("mail_username"));rn mailInfo.setPassword((String) PropertyUtil.getProperty("mail_password"));rn mailInfo.setFromAddress((String) PropertyUtil.getProperty("mail_from"));rn if (files != null) rn mailInfo.setFilesName(files);rn rnrn mailInfo.setToAddress(toAddress);rn mailInfo.setSubject(subject);rn mailInfo.setContent(content);rn MailSend sms = new MailSend();rn sms.sendHtmlMail(mailInfo);rnrn rnrn public static void send(String content, String subject, List files,rn List toAddress) rn // 这个类主要是设置邮件rn rn MailUserInfo mailInfo = new MailUserInfo();rnrn mailInfo.setMailServerHost((String) PropertyUtilrn .getProperty("mail_host"));rn mailInfo.setMailServerPort((String) PropertyUtilrn .getProperty("mail_port"));rn mailInfo.setValidate(Boolean.getBoolean((String) PropertyUtilrn .getProperty("mail_validate")));rn mailInfo.setUserName((String) PropertyUtil.getProperty("mail_username"));rn mailInfo.setPassword((String) PropertyUtil.getProperty("mail_password"));rn mailInfo.setFromAddress((String) PropertyUtil.getProperty("mail_from"));rn if (files != null) rn mailInfo.setFilesName(files);rn rnrn mailInfo.setToAddress(toAddress);rn mailInfo.setSubject(subject);rn mailInfo.setContent(content);rn MailSend sms = new MailSend();rn sms.sendHtmlMail(mailInfo);rnrn rnrn public static boolean send(Map config, String subject, ArrayList to,rn String content, Object files) rn // 这个类主要是设置邮件rn logger.info("开始发送send");rn MailUserInfo mailInfo = new MailUserInfo();rn mailInfo.setMailServerHost(((String) config.get("MAIL_HOST")).trim());rn mailInfo.setMailServerPort((String) config.get("MAIL_PORT"));rn mailInfo.setValidate(Boolean.getBoolean((String) configrn .get("MAIL_VALIDATE")));rn mailInfo.setUserName((String) config.get("MAIL_USERNAME"));rn mailInfo.setPassword((String) config.get("MAIL_PASSWORD"));rn mailInfo.setFromAddress(((String) config.get("MAIL_FROM")).trim());rn mailInfo.setFilesName(files);rn // mailInfo.setToAddress(to);rn mailInfo.setToAddress("ym-chengj@cn.fujitsu.com");rn mailInfo.setSubject(subject);rn mailInfo.setContent(content);rn MailSend sms = new MailSend();rn return sms.sendTextMail(mailInfo);rn rnrnrn
Java发送普通邮件
Java发送普通邮件,内附带了需要的jar包,有GUI可视化界面,也可以自己修改为工具类不需要GUI
java 发送QQ邮件
rnpublic class test rnrn /**rn * @param argsrn * @throws UnsupportedEncodingException rn */rn public static void main(String[] args) throws UnsupportedEncodingException rn try rn rn rn rn Properties p = new Properties(); rn p.put("mail.smtp.auth", "true"); rn p.put("mail.transport.protocol", "smtp"); rn p.put("mail.smtp.host", "smtp.qq.com"); rn p.put("mail.smtp.port", "465"); rn //建立会话 rn Session session = Session.getInstance(p); rn Message msg = new MimeMessage(session); //建立信息 rn rn rn msg.setFrom(new InternetAddress("250258561@qq.com")); //发件人 rn msg.setRecipient(Message.RecipientType.TO, rn new InternetAddress("250258561@qq.com")); //收件人 rn rn msg.setSentDate(new Date()); // 发送日期 rn String content="发送内容"; rn msg.setContent(content,"text/html;charset=GB2312"); rnrn // 邮件服务器进行验证 rn Transport tran = session.getTransport("smtp"); rn tran.connect("smtp.qq.com", "250258561", "xxxxxx"); rn tran.sendMessage(msg, msg.getAllRecipients()); // 发送 rn System.out.println("邮件发送成功"); rnrn rn rn catch(MessagingException m) rn System.out.println(m.toString()); rn rn rnrnrnrn为什么发163的就可以 QQ邮件不能发送 我的端口号都是从QQ邮箱里得到 不知道错在那里
Java发送激活邮件
Java发送激活邮件 本篇内容主要参考菜鸟教程,以及慕课网上的视频教程。 邮箱服务器(SMTP(发送协议),POP3(接收协议)) 使用jar包(JavaMail mail.jar 1.4.5 和 JAF(版本 1.1.1) activation.jar) 示例代码-HTML邮件 参考资料 示例代码-HTML邮件 代码块 下面是一个发送 HTML E-mail 的例...
Java 发送 邮件
1、Maven 中添加依赖&amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;javax.mail&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;mail&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;1.4&amp;lt;/version&amp;gt; &amp;lt;/dependency&amp;gt;2、复制如下代码/*
java发送简单邮件
1. 准备工作1.1 注册一个网页邮箱,QQ邮箱也是可以的,这里我使用的是网易邮箱来发送。1.2 注册完成后开启POP3/SMTP服务,如图所示开启服务1.3 设置授权,设置密码是邮箱登录的密码即可1.4 导包到这里,准备工作已经基本完成了。2. 源码public class MailUtil { public static void sendMessage(String toAddr,S
Java 发送163邮件
【背景】   SSH网上商城中使用的邮件发送是局域网内的,Java这么强大,干嘛要弄局域网的呢,要发就发真实的邮件。 【前提】   开启自己账号的163邮箱协议和授权码,授权码和登录邮箱账号的密码不是同一个,邮箱账号密码是登录邮箱的密码,授权码是第三方登录授权的密码,比如Foxmail或其它程序,像编写的Java程序也是第三方。 我这里已经开启了,但是我忘了,然后我是重置的,这个步骤很简单,就不...
发送QQ邮件(Java)
1 开启SMTP服务登录QQ邮箱,点击设置,切换到账户界面开启SMTP服务,点击开启使用密保手机输入&quot;配置邮件客户端&quot;至1069070069手机号,然后点击我已发送按钮,确认后,返回一串16位的代码,要记住,之后会用,这里笔者将授权码遮住了,都懂得╮( ̄▽ ̄)╭然后就可以编写java代码了,需要的jar包为mail.jar,JavaEE自带的,以防万一,我也上传了一份,有需要的可以自己下http:...
java 发送email 邮件
支持多人发送,解决了发送邮件时乱码问题.
java发送email邮件.
demo介绍:http://blog.csdn.net/love_xiolan/article/details/56016576 java发送email邮件 1.发送普通email邮件 2.发送带附件的email邮件 3.邮件抄送和密送 4.发送html邮件 5.发送模板文件
java代码实现邮件的发送
介绍:本文maven项目通过java代码实现邮件的发送,发送服务器为QQ邮箱服务器,即通过QQ邮箱实现邮件的发送首先需要开启QQ服务并获取授权码授权码是QQ邮箱推出的,用于登录第三方客户端的专用密码适用于登录以下服务:POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务QQ邮箱Web界面上方——设置——账户——找到POP3/IMAP/SMTP/Exchange/Card...
java发送QQ邮件
1.下载 javax.mail.jar  下载地址:http://www.oracle.com/technetwork/java/javamail/index.html2.下载 JAF下载地址:http://www.oracle.com/technetwork/articles/java/index-135046.html3.把 mail.jar 和 activation.jar 文件添加到您的 ...
【Java】发送激活邮件
学习即将进入第四个年头,越来越意识到积累一些常用的代码是非常有必要的。在了解整个框架的前提下,这些代码会大大提高咱们的工作效率,网上商城是一个很好的实例,希望在学习的过程中不仅仅是对Java的一个入门,还应该有一些常用代码的积累。。
JAVA实现邮件的发送
package com.sxw.springboot; import java.util.Date; import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.In
Java 发送QQ邮件
下载 Java EE Platform Downloads Java Platform Technology Downloads 把 mail.jar 和 activation.jar 文件添加到您的 CLASSPATH 中
java发送qq邮件
1.开启POP3/SMTP协议 设置--》账户--》 2.添加依赖: &amp;lt;dependency &amp;gt;             &amp;lt;groupId &amp;gt;javax.mail &amp;lt;/groupId &amp;gt;             &amp;lt;artifactId &amp;gt;mail &amp;lt;/artifactId &amp;gt;             &amp;lt;version &amp;g...
java发送outlook邮件
已经封装好工具类了,拿去直接调用就能用哈~ 需要注册outlook邮箱账号密码,登录后绑定手机号就可以正常发送邮件,经测试邮件可以成功发送,但QQ邮箱总识别为垃圾邮件,邮件在垃圾箱. package com.qs.util; import java.util.Properties; import javax.activation.DataHandler; import javax.act...
java发送网络图片邮件
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 发送图片带网络图片 正文 依赖 &lt;dependency&gt; &lt;groupId&gt;javax.mail&lt;/groupId&gt; &lt;artifactId&gt;mail&lt;/artifactId&gt; &lt;version&gt;...
java发送 邮件
public void execute(JobExecutionContext context)throws JobExecutionException { //收件人,标题和文本内容 String to = "1111@163.com";//填写你要发给谁 String title = createTitle(); String text = createText(); //设置属性 Prope...
Java发送outlook邮件
Java发送outlook邮件,也可发送notes邮件
java发送email邮件
需要依赖jar:<dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.7</version> </dependency> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1.1</version> </dependency>
java实现邮件的发送
注意以下问题:发送者使用邮件发送功能必须在邮箱中开启smtp功能 //代码演示 import javax.mail.*; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; i...
java 发送简单的邮件
这里只是简单介绍java发送一封简单的邮件    使用到的jar        直接贴代码    工具类        /** * 发送邮件 * * * @author zqh */ public class SendMile { // 发件人的 邮箱 和 密码 // PS: 某些邮箱服务器为了增加邮箱本身密码的安全性,给 SMTP 客户端设置了独立密码(有的邮箱称...
java email 邮件的发送
import com.sun.mail.util.MailSSLSocketFactory; import java.io.UnsupportedEncodingException; import java.security.GeneralSecurityException; import java.util.Properties; import java.util.logging.Lev
java发送mail邮件
在介绍之前,先说一下注意事项 ◎如果是连接的公司内部的局域网,那么最好连接公司自己搭建的邮件服务器;如果连接外部的邮件服务器,那么可能会失败(此时可以通过断开公司内部局域网,转而连接广域网来解决问题) ◎测试发送邮件时,不要发送太简单的邮件,因为有的你连接的邮件服务器可能具备检测功能,如果你发的邮件太简单,那么就会被检测到,不予发送;用时consule打印出504等错误 ◎发送邮件时,明明这...
java发送exchange邮件
java发送exchange邮件 java邮件发送,例子是按照exchange 2007测试的。
java发送html邮件
见下面java代码 @Override public String attach(String from, String[] to, String[] cc, String subject, String content, String path, String name) throws Exception { HtmlEmail email = n...
Java发送qq邮件
Java发送qq邮件,代码和jar包,Java发送qq邮件,代码和jar包
java发送Email邮件
java发送Email邮件
Java:发送163邮件
package com.sakura; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.NoSuchProviderException; import javax.mail.Session; import javax.mail
相关热词 c# stream 复制 android c# c#监测窗口句柄 c# md5 引用 c# 判断tabtip 自己写个浏览器程序c# c# 字符串变成整数数组 c#语言编程写出一个方法 c# 转盘抽奖 c#选中treeview