下面我们以QQ邮箱为例,在 application.properties 中加入如下配置(注意替换自己的用户名和密码): spring.mail.host=smtp.qq.com spring.mail.username...Failed messages: javax.mail.MessagingException: Could not convert socket to TLS; nested exception is...at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:711) at javax.mail.Service.connect...Failed messages: javax.mail.MessagingException: STARTTLS is required but host does not support STARTTLS...Failed messages: javax.mail.MessagingException: STARTTLS is required but host does not support STARTTLS
问题描述 最近准备将一个项目发布到腾讯云,在本地所有的功能都能够实现的很好,但是一到腾讯云上面就出现了一个问题: 错误报告内容:Could not connect to SMTP host: smtp..."); //服务器 prop.setProperty("mail.smtp.host", "smtp.exmail.qq.com"); //端口...prop.setProperty("mail.smtp.port", "465"); //使用smtp身份验证 prop.setProperty("mail.smtp.auth..."); //服务器 prop.setProperty("mail.smtp.host", "smtp.exmail.qq.com"); //端口...prop.setProperty("mail.smtp.port", "465"); //使用smtp身份验证 prop.setProperty("mail.smtp.auth
而这回出现的错误是:Could not connect to Redis at 192.168.2.195:6379: No route to host 这个问题以前还真没遇到过。...iptables -F 如下测试: ndscbigdata@ubuntu-bigdata-3:/usr/local/bin$ redis-cli -h "192.168.2.195" -p 6379 Could...not connect to Redis at 192.168.2.195:6379: No route to host not connected> quit ndscbigdata@ubuntu-bigdata...-3:/usr/local/bin$ redis-cli -h "192.168.2.195" -p 6379 Could not connect to Redis at 192.168.2.195:6379...: No route to host not connected> quit ndscbigdata@ubuntu-bigdata-3:/usr/local/bin$ redis-cli -h "192.168.2.195
", "smtp.qq.com"); // 发送服务器需要身份验证 props.setProperty("mail.smtp.auth", "true");...工具类二 #smtp server mail.smtp.host=smtp.qq.com #Authentication mail.smtp.auth=true #-------------------...* 寻找"mail.smtp.host" 属性值就是发送邮件的主机 * 寻找"mail.smtp.auth" 身份验证,目前免费邮件服务器都需要这一项 */ private...---- 带有附件的邮件 #smtp server mail.smtp.host=smtp.qq.com #Authentication mail.smtp.auth=true #-----------..."); // smtp验证 transport.connect(mailHost, sender_username, sender_password);
后台设置 import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException...收件人电子邮箱 String to = " "; // 发件人电子邮箱 String from = ""; // 指定发送邮件的主机为 smtp.qq.com...String host = "smtp.qq.com"; //QQ 邮件服务器 String pwd = ""; //QQ 邮件服务器 // 获取系统属性...Properties properties = System.getProperties(); // 设置邮件服务器 properties.setProperty("mail.smtp.host...", host); properties.put("mail.smtp.auth", "true"); // 获取默认session对象 Session
// 设置服务器地址和端口,网上搜的到 sender.setProperties("smtp.qq.com...sender.setReceiver(new String[] { "收件人邮箱" }); sender.sendEmail("smtp.qq.com..., String post) { // 地址 this.properties.put("mail.smtp.host", host... transport.connect(host, account, pwd); // 发送邮件 ...= "smtp.qq.com"; // default smtp server _port = "465"; // default smtp port
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate) 具体报错信息如下: javax.mail.MessagingException...: Could not connect to SMTP host: smtp.163.com, port: 465; nested exception is: javax.net.ssl.SSLHandshakeException...No appropriate protocol (protocol is disabled or cipher suites are inappropriate) at com.sun.mail.smtp.SMTPTransport.openServer...(SMTPTransport.java:1963) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)...at javax.mail.Service.connect(Service.java:345) at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport
pop.put("mail.smtp.auth", "true");//注意value值不能不设置,并且不能是Boolean类型,应为字符串,否则会报如上所示错误 问题②: Could not connect...to SMTP host: smtp.qq.com, port: 465, response: -1 原因: 465端口是为SMTPS(SMTP-over-SSL)协议服务开放的,这是SMTP..."); 附上所有的代码: 配置文件: mail: mailhost: smtp.qq.com mailport: 465 user: 邮箱用户名 password: 密码...mailSender.setPassword(this.password); // 加认证机制 Properties pop = new Properties(); pop.put("mail.smtp.host...", this.host); // pop.put("mail.smtp.port", this.port);//已经在上面加过 pop.put("mail.smtp.auth", this.auth
QQ邮箱配置 spring: mail: host: smtp.qq.com #发送邮件服务器 username: xx@qq.com #QQ邮箱 password: xxxxxxxxxxx...username保持一致 说明:开启SSL时使用587端口时无法连接QQ邮件服务器 网易系(126/163/yeah)邮箱配置 spring: mail: host: smtp.126.com...还需要开启允许不够安全的应用 ,不然会出现Authentication failed的异常 选择登录与安全滑到底部有个允许不够安全的应用开启即可 spring: mail: host: smtp.gmail.com...调用JavaMailSender接口发送邮件 package cn.qiucode.service; import javax.mail.MessagingException; /** * Created...org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.stereotype.Service; import javax.mail.MessagingException
spring-boot-starter-mail application.yml配置文件新增 spring: mail: # qq host...: smtp.qq.com #发送邮件服务器 username: xx@qq.com #QQ邮箱 password: xxxxxxxxxxx #客户端授权码 protocol:...,端口号:465或者994 host: smtp.126.com username: xx@126.com password: xxxxxxxx protocol: smtp...default-encoding: utf-8 from: xx@126.com # 谷歌邮箱 host: smtp.gmail.com username: xxx@gmail.com...org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import javax.mail.MessagingException
准备工作 发送邮箱需要去开启 POP3/SMTP服务, 下面所有的密码都是授权码!!!!...="localhost"; private static String HOST="smtp.163.com"; //帐号 // private static String ACCOUNT = "test..."); //设置发送邮件的服务器 props.setProperty("mail.host", HOST); props.setProperty("mail.smtp.auth", "...="localhost"; private static String HOST="smtp.qq.com"; //帐号 // private static String ACCOUNT = "zzzgdx..."); //设置发送邮件的服务器 props.setProperty("mail.host", HOST); props.setProperty("mail.smtp.auth", "
org.springframework.util.StringUtils; 5 6 import java.util.Properties; 7 8 import javax.mail.Message; 9 import javax.mail.MessagingException...MailUtil(Properties properties, boolean debug) { 30 this.smtpHost = properties.getProperty("mail.smtp.host..."); 87 transport.connect(smtpHost, smtpPort, senderUserName, senderPassword); 88...} 103 } 104 } 105 } 106 107 } 步骤3:配置 a) 属性文件mail.properties 1 mail.smtp.host...=smtp.qq.com 2 mail.smtp.port=25 3 mail.smtp.auth=true 4 mail.sender.username=xxx@qq.com 5 mail.sender.password
152 153 154 155 156 157 158 159 160 161 import java.util.Date; import java.util.Properties; import javax.mail.MessagingException...服务器的主机名,这里以qq邮箱为例 private static final String SMTP_HOST = "smtp.qq.com"; //连接的端口号,587为ssl端口,默认为...// get the transport final Transport transport = session.getTransport(); transport.connect...// get the transport final Transport transport = session.getTransport(); transport.connect..."); props.setProperty("mail.host", SMTP_HOST); props.setProperty("mail.smtp.auth", "true
G:\mylearn\source-code>git pull ssh: connect to host github.com port 22: Connection timed out fatal:...Could not read from remote repository....G:\mylearn\source-code>ssh -T git@github.com ssh: connect to host github.com port 22: Connection timed...G:\mylearn\source-code>ssh -T git@github.com The authenticity of host '[ssh.github.com]:443 ([192.30.253.122...G:\mylearn\source-code>git pull Warning: Permanently added the RSA host key for IP address '[192.30.253.123
email.properties文件如下: host=smtp.qq.com //这是qq邮箱,如果是其他邮箱 服务要配置成相应的host user=自己邮箱名...javax.activation.FileDataSource; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException...= mb.getNick(); Properties props = System.getProperties(); props.put("mail.smtp.host...", map.get("host")); // 设置SMTP的主机 props.put("mail.smtp.auth", "true");...// 需要经过验证 if(map.get("host").contains("gmail")){ props.setProperty("mail.smtp.socketFactory.class
spring-boot-starter-mail', version: '2.4.10' 复制代码 application.yml配置 spring: mail: # 邮件服务器地址 host...: smtp.qq.com # SMTP 服务器的端口 port: 587 username: 1786087581@qq.com # 这里的密码是邮件授权码不是邮箱登陆的密码...服务器地址:smtp.126.com,端口号:465或者994 2163邮箱SMTP服务器地址:smtp.163.com,端口号:465或者994 yeah邮箱SMTP服务器地址:smtp.yeah.net...,端口号:465或者994 qq邮箱SMTP服务器地址:smtp.qq.com,端口号465或587* 4.邮件发送 4.1 简单邮件发送 import io.swagger.annotations.Api...; import io.swagger.annotations.ApiOperation; import java.io.File; import java.util.Date; import javax.mail.MessagingException
Resolving host smtp.exmail.qq.com . . . done....Connecting to 163.177.72.143:smtp . . .Connecting to 163.177.90.125:smtp . . .could not connect: Connection...失败接收邮件的结果: Connecting to 163.177.72.143:smtp . . .Connecting to 163.177.90.125:smtp . . .could not connect...: Connection timed out 从上面发送日志里,可以看到上图错误提示 could not connect: Connection timed out,发送失败了,因此也不可能成功收到邮件...4 5 echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE
QQ邮箱服务 第一步 登录QQ邮箱,在“帐户”里开启“POP3/SMTP”并获取授权码,授权码的说明见http://service.mail.qq.com/cgi-bin/help?...的端口为默认端口,即25;不需要使用SSL协议,如果勾选“使用SSL协议”会报异常:javax.mail.MessagingException: Could not connect to SMTP host..., plaintext connection 163邮箱服务 个人邮箱 第一步 登录163邮箱,在“设置”->“POP3/SMTP/IMAP”设置授权码 第二步 在Jenkins的“系统管理”->“系统设置...第一步”中设置的授权码,如果用登录密码会报异常javax.mail.AuthenticationFailedException: 535 Error: authentication faile 关于“smtp...服务器”的设置,163邮件的帮助文档里写的是“smtp.126.com”,不要按文档上写的而要使用“smtp.163.com” 163 smtp协议可用端口如下图: 实际验证发现端口25也可用于SSL
spring-boot-starter-freemarker 2、application.yml 文件配置配置邮件发送信息 spring: mail: host...: smtp.qq.com username: xxx@qq.com #发件人邮箱 password: xxxxx #授权码 protocol: smtp properties.mail.smtp.auth...: xiaoming properties.mail.smtp.starttls.enable:true properties.mail.smtp.starttls.required:true properties.mail.smtp.ssl.enable...:/templates/ 3、创建IEmailService 接口文件,定义邮件发送的接口 package com.springboot.email.email.service; import javax.mail.MessagingException...org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.mail.MessagingException
artifactId>spring-boot-starter-mail 配置文件: spring: mail: # 配置 SMTP...服务器地址 host: smtp.qq.com # 发送者邮箱 username: ooahz@qq.com # 邮箱密码(即邮件授权码) password:...# 默认的邮件编码为UTF-8 default-encoding: UTF-8 # 配置SSL 加密工厂 properties: mail: smtp...org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import javax.mail.MessagingException...org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import javax.mail.MessagingException
领取专属 10元无门槛券
手把手带您无忧上云