JavaMail API, Gmail-Auth and setFrom(JavaMail API、Gmail-Auth 和 setFrom)
问题描述
对于这个应用程序,我遵循这个例子:
for this app i'm following this example:
http://pipoltek.blogspot.com/2008/02/sending-mail-using-gmail-smtp-server.html
我可以发送电子邮件,看起来不错.....但我想使用此修改发件人电子邮件:
I can send emails, it looks good.....but i want to modify the sender email using this:
MimeMessage msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress("baba-jaga@gmail.com"));
baba-jaga@gmail.com 是虚拟电子邮件,不是我的 :)
baba-jaga@gmail.com is dummy E-Mail, is not mine :)
当我使用 setFrom
时,我会收到来自这封电子邮件的电子邮件,我用它来进行身份验证.身份验证是禁用 setFrom
方法的原因吗?
When t use setFrom
, i recive the email from this email, which i use to authenticate. Is the authentication the reason, which disable the setFrom
method?
我需要更改发件人"电子邮件,因为我希望收件人向我发送重播到另一个电子邮件地址.
I need to change the "from" email, because i want, that the recipient send me an replay to another email adress.
推荐答案
Google 的 SMTP 服务器阻止使用来自已验证帐户的地址以外的发件人地址.这是一种防止所谓的欺骗"的安全措施.也许您可以尝试将回复设置为另一个值,看看 Google 是否允许这样做.
Google's SMTP server is preventing using a from address other than the one belonging to the account that has been authenticated. This is a security measure to prevent what is known as "spoofing". Perhaps you can try setting the reply-to to another value and see if Google will allow that.
这篇关于JavaMail API、Gmail-Auth 和 setFrom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:JavaMail API、Gmail-Auth 和 setFrom


- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 转换 ldap 日期 2022-01-01
- 获取数字的最后一位 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01