465-535-465怎么样怎么简便计算

java - How to configure Spring JavaMailSenderImpl for Gmail - Stack Overflow
Join Stack Overflow to learn, share knowledge, and build your career.
or sign in with
I am trying to find the correct properties to use to connect to the Gmail SMTP sever using the JavaMailSenderImpl class.
Let me first say that I have tried the approach found .
This worked fine.
But when I tried the configuration below that post with the exact same authentication information I received a javax.mail.AuthenticationFailedException.
My currently configuration looks like this.
&bean id="mailSender" class ="org.springframework.mail.javamail.JavaMailSenderImpl" &
&property name="username" value="" /&
&property name="password" value="XXX" /&
&property name="javaMailProperties"&
&prop key="mail.smtp.host"&smtp.gmail.com&/prop&
&prop key="mail.smtp.port"&587&/prop&
&prop key="mail.smtp.auth"&true&/prop&
&prop key="mail.smtp.starttls.enable"&true&/prop&
&/property&
Why am I still getting this javax.mail.AuthenticationFailedException if I know that my credentials are correct.
Here is my updated code based on the answers below.
I am still receiving the same exception.
&bean id="mailSender" class ="org.springframework.mail.javamail.JavaMailSenderImpl" &
&property name="username" value="" /&
&property name="password" value="XXX" /&
&property name="javaMailProperties"&
&prop key="mail.smtp.from"&&/prop&
&prop key="mail.smtp.user"&&/prop&
&prop key="mail.smtp.password"&XXX&/prop&
&prop key="mail.smtp.host"&smtp.gmail.com&/prop&
&prop key="mail.smtp.port"&587&/prop&
&prop key="mail.smtp.auth"&true&/prop&
&prop key="mail.smtp.starttls.enable"&true&/prop&
&/property&
This worked for me:
&property name="host"&&value&smtp.gmail.com&/value&&/property&
&property name="port"&&value&587&/value&&/property&
&property name="protocol"&&value&smtp&/value&&/property&
&property name="username"&&value&${mail.username}&/value&&/property&
&property name="password"&&value&${mail.password}&/value&&/property&
&property name="javaMailProperties"&
&prop key="mail.smtp.auth"&true&/prop&
&prop key="mail.smtp.starttls.enable"&true&/prop&
&prop key="mail.smtp.quitwait"&false&/prop&
&/property&
The real trick for me turned out to be that the "protocol" value has to be "smtp" (not "smtps").
I struggled for an hour to find the right settings to send an email from Gmail using javamailsender and finally did it. I'm posting this as I cannot find a comprehensive example to send through gmail with javamailsender so hopefully this will help someone who want to do the same thing:
Add the following settings to mail.properties:
mail.protocol=smtp
mail.host=smtp.gmail.com
mail.port=465
mail.smtp.socketFactory.port=465
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.debug=true
mail.smtp.starttls.required=true
mail.smtp.socketFactory.fallback=false
mail.from=
mail.username=
mail.password=my_password
And then in your mailConfiguration class, @Value them in:
@Configuration
@PropertySource("classpath:mail.properties")
public class MailConfiguration {
@Value("${mail.protocol}")
@Value("${mail.host}")
@Value("${mail.port}")
@Value("${mail.smtp.socketFactory.port}")
private int socketP
@Value("${mail.smtp.auth}")
@Value("${mail.smtp.starttls.enable}")
@Value("${mail.smtp.starttls.required}")
private boolean startlls_
@Value("${mail.smtp.debug}")
@Value("${mail.smtp.socketFactory.fallback}")
@Value("${mail.from}")
@Value("${mail.username}")
@Value("${mail.password}")
public JavaMailSender javaMailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
Properties mailProperties = new Properties();
mailProperties.put("mail.smtp.auth", auth);
mailProperties.put("mail.smtp.starttls.enable", starttls);
mailProperties.put("mail.smtp.starttls.required", startlls_required);
mailProperties.put("mail.smtp.socketFactory.port", socketPort);
mailProperties.put("mail.smtp.debug", debug);
mailProperties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
mailProperties.put("mail.smtp.socketFactory.fallback", fallback);
mailSender.setJavaMailProperties(mailProperties);
mailSender.setHost(host);
mailSender.setPort(port);
mailSender.setProtocol(protocol);
mailSender.setUsername(username);
mailSender.setPassword(password);
return mailS
Please note that my Spring server is SSL enabled so that is why I'm using port 465. For SSL use port 465. If you are using 487, you must be using TLS.
Following this link and choose to turn on access to less secure apps.
Turn off AVAST if you have it on your PC. The AVAST Mail Shield conflicts with sending out emails. If you do not turn it off, you will get the following error:
Servlet.service() for servlet [dispatcherServlet] in context with path
[] threw exception [Reque nested exception is
org.springframework.mail.MailSendException: Mail server connection
nested exception is javax.mail.MessagingException: Exception
nested exception is:
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target.
9,4221178131
For Gmail to work with TLS or SSL:
Port for TLS/STARTTLS: 587
Port for SSL: 465
Both are manditory paramater are javax.net.ssl.SSLSocketFactory, mail.smtp.socketFactory.fallback and make mail.smtp.starttls.enable to false.
&bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&
&property name="host"&&value&smtp.gmail.com&/value&&/property&
&property name="port"&&value&465&/value&&/property&
&property name="protocol"&&value&smtp&/value&&/property&
&property name="username"&&value&&/value&&/property&
&property name="password"&&value&XXXX&/value&&/property&
&property name="javaMailProperties"&
&prop key="mail.smtp.auth"&true&/prop&
&prop key="mail.smtp.starttls.enable"&false&/prop&
&prop key="mail.smtp.quitwait"&false&/prop&
&prop key="mail.smtp.socketFactory.class"&javax.net.ssl.SSLSocketFactory&/prop&
&prop key="mail.smtp.socketFactory.fallback"&false&/prop&
&prop key="mail.debug"&true&/prop&
&/property&
&bean id="mailMail" class="com.embitel.service.email.EmailService"&
&property name="mailSender" ref="mailSender" /&
&property name="simpleMailMessage" ref="customeMailMessage" /&
&bean id="customeMailMessage" class="org.springframework.mail.SimpleMailMessage"&
&property name="from" value="" /&
&property name="to" value="" /&
&property name="subject" value="Testing Subject Line for email senind.." /&
&property name="text"&
Mail Content : %s
&/property&
worked like a charm!!!
Sometime/first time google prevent the sign in to your account by any third party application or using your code. when you will sign in to your account in browser, you will get a message
"Google prevents a Suspicious attempt to sign in to your account"
see the screenshot below.
click on the "Was it you" and allow the sign in.
3,39622027
The only property needed for GMail is
&prop key="mail.smtp.starttls.enable"&true&/prop&
1,56631933
Here's the javaConfig that worked for me:
public JavaMailSender getJavaMailSender()
JavaMailSenderImpl sender = new JavaMailSenderImpl();
sender.setProtocol("smtp");
sender.setHost("smtp.gmail.com");
sender.setPort(587);
sender.setUsername("username");
sender.setPassword("password");
Properties mailProps = new Properties();
mailProps.put("mail.smtps.auth", "true");
mailProps.put("mail.smtp.starttls.enable", "true");
mailProps.put("mail.smtp.debug", "true");
sender.setJavaMailProperties(mailProps);
I think you need to use port 587 for the TLS to work.
9,47142044
This doesn't seem significantly different, but perhaps try:
&bean id="mailSender" class ="org.springframework.mail.javamail.JavaMailSenderImpl" &
&property name="username" value="" /&
&property name="password" value="XXX" /&
&property name="javaMailProperties"&
&prop key="mail.smtp.user" value="" /&
&prop key="mail.smtp.password" value="XXX" /&
&prop key="mail.smtp.host"&smtp.gmail.com&/prop&
&prop key="mail.smtp.port"&587&/prop&
&prop key="mail.smtp.auth"&true&/prop&
&prop key="mail.smtp.starttls.enable"&true&/prop&
&/property&
20.6k1994136
You should specify your "from" address, either as &prop key="mail.smtp.from"&&/prop&, or when creating a message.
194k30409424
This worked for me:
&bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&
&property name="host" value="smtp.gmail.com" /&
&property name="port" value="465" /&
&property name="protocol" value="smtps" /&
&property name="username" value="my_email@domain.tld" /&
&property name="password" value="my_password" /&
&property name="javaMailProperties"&
&prop key="mail.smtps.auth"&true&/prop&
&/property&
See Google support for further information:
I have resoloved your question.
Note, this works on spring 3 , so I am not sure with spring 2.
I was also facing this authentication exception and this is because of the gmail security. Open the following url
and enable the less security feature.
The config below (yaml format) worked for me after
I disabled 2 factor authentication
I enabled less secure apps
spring.mail:
host: smtp.gmail.com
protocol: smtp
password: abc
test-connection: true
properties:
"mail.smtp.auth": true
"mail.smtp.starttls.enable": true
"mail.smtp.starttls.required": true
"mail.smtp.socketFactory.class": javax.net.ssl.SSLSocketFactory
"mail.debug": true
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Upcoming Events
ends Mar 27
Stack Overflow works best with JavaScript enabled【宅舞】Rosetta【东と加藤】精编-在线观看-风行网
全部标记为已读
您暂未收到新消息哦~
安装PC客户端
把想看的剧下载到本地吧~
点击立即下载就可以下载当前视频了哦~
我来说两句
播放:183,223
播放:209,238
播放:170,555
播放:166,505
播放:302,140
播放:32,949
播放:251,431
播放:223,500
播放:8,110
播放:16,009
播放:7,658
播放:11,807
精选视频号
播放:1,515已知有下列一些数:915,464,649,535,792,501,127,209,234,378,465.在括号里写出它们_百度知道
已知有下列一些数:915,464,649,535,792,501,127,209,234,378,465.在括号里写出它们
915,535,127,464,649,465,792已知有下列一些数,234,378,501,209
我有更好的答案
464+535+501=1500
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。2017集美大学各省录取分数线【不断更新中】_高三网当前位置: > > > 正文2017集美大学各省录取分数线【不断更新中】 10:00:22文/董玉莹  2017集美大学各省录取分数线陆续发布,小编整理了《2017集美大学各省录取分数线》供参考。由于各省录取分数线尚未完全公布,所以小编未收集完整。12017集美大学各省录取分数线省份批次科类第一轮投档分备注内蒙古本科提前A(汉授美术)艺术文225按文化分出档山西本科提前艺术体育(美术)艺术专194.9线上生源全投,按专业分出档山西本科提前艺术体育(音乐)艺术专70线上生源全投,按专业分出档山西本科提前艺术体育(舞蹈)艺术专63线上生源全投,按专业分出档广西提前批航海类理工319上海航海技术综合改革427上海轮机工程综合改革414甘肃提前批航海类理工423甘肃提前批艺术类艺术专235按专业分出档福建提前批航海类理工375福建提前批师范类文史497福建提前批师范类理工468福建提前批师范类(面向厦门)文史490福建提前批师范类(面向厦门)理工459陕西提前本科(美术)艺术专226按专业分出档四川提前批航海类理工467北京提前批航海类理工476河北本科提前批A(声乐)艺术专178.4河北本科提前批A(器乐)艺术专164.6河北本科提前批A(舞蹈)艺术专162.2河北本科提前批A(美术)艺术专181.3线上生源全投,按专业分出档新疆本科第零批艺术类艺术文156线上生源全投,按文化分出档江西提前批航海类理工473山东提前批航海类理工435黑龙江提前批航海类理工436安徽提前批航海类理工440河南艺术本科A段(声乐)艺术主项77按专业分出档河南艺术本科A段(器乐)艺术主项91按专业分出档河南艺术本科A段(舞蹈)艺术主项76按专业分出档河南艺术本科A段(美术)艺术综469.4按综合分出档(我校规则)河南提前批航海类理工418湖南艺术本科(音乐)文史专252按专业分出档湖南艺术本科(舞蹈)文史专244按专业分出档湖南艺术本科(美术)文史综530.3按综合分出档(我校规则)吉林提前批航海类理工431湖南提前批航海类理工432贵州提前批航海类理工361重庆艺术本科(音乐)文史专212按专业分出档云南提前批航海类理工453重庆提前批航海类理工446福建体育本科理工综543福建体育本科文史综555江苏艺术美术艺术综509按该省综合分出档广西艺术舞蹈艺术综550按该省综合分出档天津提前批航海类理工406海南提前批航海类理工545北京艺术类艺术文345线上生源全投,文化分出档四川国家专项计划文史567四川国家专项计划理工546河南国家专项计划文史542河南国家专项计划理工519湖南国家专项计划文史560湖南国家专项计划理工510黑龙江国家专项计划理工479河北提前批航海类理工419河北国家专项计划理工551辽宁提前批航海类理工424湖北提前批航海类理工448浙江提前批航海类理工481安徽艺术二批(美术)艺术综764按该省综合分出档安徽艺术二批(音乐)艺术综712按该省综合分出档福建艺术A批(闽台环境设计)艺术文综535.5福建艺术A批(闽台环境设计)艺术理综518.55福建艺术A批(美术学)艺术文综519.6福建艺术A批(美术学)艺术理综499.5福建艺术A批(音乐学)艺术文综555.8福建艺术A批(音乐学)艺术理综539.3福建艺术A批(舞蹈表演)艺术文专261福建艺术A批(舞蹈表演)艺术理专224云南国家专项计划理工520云南国家专项计划文史579重庆国家专项计划文史536重庆国家专项计划理工491福建农村专项计划文史497福建农村专项计划理工467贵州国家专项计划文史586贵州国家专项计划理工487内蒙古本一批文史518内蒙古本一批理工497安徽国家专项计划文史557安徽国家专项计划理工542山东艺术类(美术)艺术文文328按文化分出档江苏本一批文史338江苏本一批理工336山西提前批航海类理工410福建本一批(面向厦门)文史499福建本一批(面向厦门)理工462福建本一批(闽台合作)理工443福建本一批文史508福建本一批理工468浙江普通本科批综合改革578四川艺术类(美术)艺术专257按专业分出档四川艺术类(音乐表演)艺术专319按专业分出档四川艺术类(舞蹈表演)艺术专351按专业分出档河北本一批文史578河北本一批理工549浙江艺术类(美术)艺术综571按该省综合分出档浙江艺术类(音乐表演)艺术综521按该省综合分出档海南本科A批文史680海南本科A批理工622河南本一批文史559河南本一批理工539云南本一批理工509江西本一批文史577江西本一批理工548山东本科批文史567山东本科批理工563四川本一批文史562四川本一批理工559安徽本一批文史562安徽本一批理工544北京本二批文史525北京本二批理工510天津本二批文史516天津本二批理工495上海本科批专业组1452物理上海本科批专业组2446物理+化学上海本科批专业组3460物理+化学+地理上海本科批专业组4457不限广东艺术二本(环境设计)艺术专240 文434混合投档广东艺术二本(音乐表演)艺术专231 文380混合投档甘肃本一批文史530甘肃本一批理工505福建少数民族预科文史489第一轮只投本一线上考生福建少数民族预科理工442第一轮只投本一线上考生贵州本一批文史602贵州本一批理工528辽宁本一批文史556辽宁本一批理工544四川少数民族预科文史533四川少数民族预科理工504湖北艺术本科二批(美术)文史综589.2按该省综合分出档湖北艺术本科二批(舞蹈)文史专224.4按专业分出档新疆内地班本二批(民考汉)文史410新疆内地班本二批(民考汉4年)文史372新疆内地班本二批(汉语言)理工469新疆内地班本二批(民考汉)理工380新疆内地班本二批(民考汉4年)理工345广东本二批文史522广东本二批理工482云南艺术本二批(音乐表演)艺术专158.43按专业分出档广西本二批文史543广西本二批理工474山西本一批文史527山西本一批理工490湖南本二批文史559湖南本二批理工505陕西本二批文史511陕西本二批理工457青海本二批文史464青海本二批理工361青海少数民族预科文史421青海少数民族预科理工362  想了解更多集美大学录取分数线内容请查看:频道12016集美大学各省录取分数线省份批次科类省控线最高分最低分平均分安徽提前批航海类理工494555473495安徽本一批理工518576565569安徽本一批文史521568559560北京提前批航海类理工494———北京本二批理工494537521528北京本二批文史532551548549福建提前批航海类理工352485409443福建师范类-全省理工465520487497福建师范类-全省文史501533508517福建师范类-厦门理工465513487501福建师范类-厦门文史501542513519福建农村专项计划理工465544493508福建农村专项计划文史501552511525福建本一批理工465564465510福建本一批文史501558510529福建本一批(面向厦门)理工465541481498福建本一批(面向厦门)文史501541508523福建闽台合作理工465507468475福建预科批理工479431453福建预科批文史507456479甘肃提前批航海类理工435494445460甘肃本一批理工490531523528甘肃本一批文史504535529532甘肃本二批理工435513486492甘肃本二批文史455514506509广东本二批理科402537501507广东本二批文科417520514516广西提前批航海类理工333507339405广西本二批理工333529501509广西本二批文史400575554561贵州提前批航海类理工365476365401贵州专项计划理工473529501514贵州专项计划文史551593577584贵州本一批理工473562551555贵州本一批文史551616598601贵州本二批理工365551462480贵州本二批文史457577565568海南提前批航海类理工543604545573海南本一批理工602638622630海南本二批理工543619610614海南本二批文史577693667674河北提前批航海类理工364559388487河北专项计划理工525587578581河北本一批理工525595579586河北本一批文史535601582588河南提前批航海类理工447551447488河南专项计划理工523564543553河南专项计划文史517549533539河南本一批理工523578562566河南本一批文史517565548552黑龙江提前批航海类理工369527449471黑龙江专项计划理工486494493494黑龙江本二批理工369552527534黑龙江本二批文史401520510514湖北提前批航海类理工350520485503湖北本二批理工350588519528湖北本二批文史403541525531湖南提前批航海类理工439520439471湖南专项计划理工517520516518湖南专项计划文史530538538538湖南本二批理工439552523531湖南本二批文史476547541543吉林提前批航海类理工402533470497吉林本二批理工402539501515吉林本二批文史413530475511江苏提前批航海类理科315339316323江苏本一批理科353360351355江苏本二批理科315353346348江苏本二批文科325355350352江西提前批航海类理工445536501517江西本一批理工529585565570江西本一批文史523564555559江西本二批理工445547535538江西本二批文史450535529530辽宁提前批航海类理工373523385447辽宁本一批理工498579537557辽宁本一批文史525555548551内蒙古本一批理工484542521530内蒙古本一批文史477537523528宁夏本二批理工434488463471宁夏本二批文史486526519522青海本二批理工380464418438青海本二批文史415507467486青海预科批理工401389396青海预科批文史457424442山东提前批航海类理工451563451502山东本一批理工537601584589山东本一批文史530569559562山东本二批理工451583515551山东本二批文史474541534538山西提前批航海类理工438508443468山西本一批理工519552521530山西本一批文史518536522528陕西本二批理工423496469478陕西本二批文史460517512515上海提前批航海类理工360———上海本科批理科360432391399上海本科批文科368429408415四川提前批航海类理工453546456505四川专项计划理工532596556568四川专项计划文史540573570572四川本一批理工532597571579四川本一批文史540580574577四川预科批理工535514529四川预科批文史532522527天津提前批航海类理工424504414443天津本二批理工424508485492天津本二批文史460532517523西藏本一批(汉考汉)理工425497442467西藏本一批(汉考汉)文史440492467477西藏本一批(民考汉)理工285328299312西藏本一批(民考汉)文史325386354369新疆专项计划理工464453440446新疆专项计划文史487507474486新疆本二批理工394514494499新疆本二批文史415521514516新疆本二批(定向)理工394494474485新疆本二批(定向)文史415509487494新疆预科批理工399385392新疆预科批文史466434447云南提前批航海类理工445509446467云南专项计划理工525556516537云南专项计划文史560586585586云南本一批理工525543527531云南本二批理工445548503525云南本二批文史495579567573云南预科批理工493473482云南预科批文史552530537浙江提前批航海类理工439542451487浙江本二批理工439553538545浙江本二批文史462556554555重庆提前批航海类理工416526469497重庆专项计划理工525529520525重庆专项计划文史527538531535重庆本二批理工416574522533重庆本二批文史435555538544重庆本二批(定向)理工416530523526重庆本二批(定向)文史435529516520重庆预科批理工480468475重庆预科批文史4974734831集美大学简介集美大学为福建省重点建设高校,是交通运输部与福建省、国家海洋局与福建省、福建省与厦门市共建高校,博士学位授予单位,面向全国招生。集美大学办学历史悠久。始于著名爱国华侨领袖陈嘉庚先生1918年创办的集美师范学校,迄今已90多年,校训“诚毅”为陈嘉庚先生和其弟陈敬贤先生所立。创建时间学校类型学科类型隶属单位1918年公立综合福建省人民政府  以上《2017集美大学各省录取分数线【不断更新中】》为高三网小编整理,更多精彩内容尽在高三网。推荐阅读日日日日日日日日日日日日日日点击查看更多内容}

我要回帖

更多关于 简便计算题大全 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信