发送电子邮件没有身份验证在java使用gmail smtp服务器和javamail [英] Send Email Without authentication in java using gmail smtp server and javamail

查看:1817
本文介绍了发送电子邮件没有身份验证在java使用gmail smtp服务器和javamail的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Javamail api和gmail smtp服务器在java中发送邮件而不给出密码。我使用下面的代码。这里我使用javax.mail jar文件

I am using Javamail api and gmail smtp server to send mail in java without giving password. I have using the below code. here i am using javax.mail jar file

     Properties props= new Properties();

     props.put("mail.smtp.host", "smtp.gmail.com");
     props.put("mail.smtp.port", 587);
     props.put("mail.transport.protocal", "smtps");
     //Put below to false, if no https is needed
     props.put("mail.smtp.STARTTLS.enable", "false");
     props.put("mail.smtp.auth", "false");

     Session session = Session.getInstance(props);

我收到以下错误

      Must issue a STARTTLS command first. b4sm3005855pdh.2 - gsmtp

实现代码有没有错误?是不是可以实现没有密码?有任何一个帮助我这个

Is there any wrong in implementing the code? is it posssible to implement without password ? pls any one help me on this

推荐答案

首先,属性的名称是mail.smtp.starttls.enable。

First, the name of the property is "mail.smtp.starttls.enable".

第二,不,您不能通过Gmail发送邮件,而无需先验证,例如使用您的密码。

Second, no, you can't send mail through Gmail without authenticating first, e.g., using your password.

这篇关于发送电子邮件没有身份验证在java使用gmail smtp服务器和javamail的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆