如何使用Gmail和Java从其他地址发送邮件?

时间:2021-05-05 09:50:57

I'm using Java to send messages from Gmail with Apache Commons Email, but it seems like it doesn't allow me to send messages from an address different from the one that I use to authenticate.

我正在使用Java通过Apache Commons Email从Gmail发送邮件,但似乎它不允许我从与我用于验证的地址不同的地址发送邮件。

How do you send messages from a different address using Gmail and Java?

如何使用Gmail和Java从其他地址发送邮件?

3 个解决方案

#1


0  

Basically, you are looking for an SMTP server which will let you send a message by spoofing the From MIME header. Well, if you can't find a hosted SMTP server online, you can always install one locally on your box. This will allow you to modify the email address of the sender to make it appear as if it is coming from gmail.

基本上,您正在寻找一个SMTP服务器,它允许您通过欺骗From MIME标头发送消息。好吧,如果你在网上找不到托管的SMTP服务器,你可以随时在你的盒子上安装一个。这将允许您修改发件人的电子邮件地址,使其看起来好像来自gmail。

#2


0  

As far as I'm aware you can't. That is what is called relaying. Relaying is what the spammers use to send mail pretending to be whoever. Its a security hole. If you want to send as someone else you need to create another account.

据我所知你不能。这就是所谓的中继。转发是垃圾邮件发送者用来发送假装成谁的邮件。它是一个安全漏洞。如果您想以其他人身份发送,则需要创建另一个帐户。

#3


0  

How do you send messages from a different address using Gmail and Java?

如何使用Gmail和Java从其他地址发送邮件?

For gmail, you most likely can't ... for obvious reasons.

对于gmail,你很可能不能......出于显而易见的原因。

In the Java case, whether you can or can't do this depends on the mail server that your Java application connects to. A mail server typically can be configured to allow this, but it has obvious issues so a responsible mail server admin is not going to allow this, except in controlled circumstances.

在Java情况下,您是否可以执行此操作取决于Java应用程序连接到的邮件服务器。邮件服务器通常可以配置为允许这样做,但它有明显的问题,因此负责的邮件服务器管理员不会允许这样做,除非在受控情况下。

#1


0  

Basically, you are looking for an SMTP server which will let you send a message by spoofing the From MIME header. Well, if you can't find a hosted SMTP server online, you can always install one locally on your box. This will allow you to modify the email address of the sender to make it appear as if it is coming from gmail.

基本上,您正在寻找一个SMTP服务器,它允许您通过欺骗From MIME标头发送消息。好吧,如果你在网上找不到托管的SMTP服务器,你可以随时在你的盒子上安装一个。这将允许您修改发件人的电子邮件地址,使其看起来好像来自gmail。

#2


0  

As far as I'm aware you can't. That is what is called relaying. Relaying is what the spammers use to send mail pretending to be whoever. Its a security hole. If you want to send as someone else you need to create another account.

据我所知你不能。这就是所谓的中继。转发是垃圾邮件发送者用来发送假装成谁的邮件。它是一个安全漏洞。如果您想以其他人身份发送,则需要创建另一个帐户。

#3


0  

How do you send messages from a different address using Gmail and Java?

如何使用Gmail和Java从其他地址发送邮件?

For gmail, you most likely can't ... for obvious reasons.

对于gmail,你很可能不能......出于显而易见的原因。

In the Java case, whether you can or can't do this depends on the mail server that your Java application connects to. A mail server typically can be configured to allow this, but it has obvious issues so a responsible mail server admin is not going to allow this, except in controlled circumstances.

在Java情况下,您是否可以执行此操作取决于Java应用程序连接到的邮件服务器。邮件服务器通常可以配置为允许这样做,但它有明显的问题,因此负责的邮件服务器管理员不会允许这样做,除非在受控情况下。