简体   繁体   中英

Is it possible to mask/spoof email address while sending mail in Java

In simple word, whenever I will send mail to anyone (within same mail server) it should appears some fake email address ie fakemail@gmail.com but, when they reply to this mail, it should come to my actual email address that is realname@gmail.com .

Note: My both email addresses will use same domain name, but only difference will be fake and real username for that email. I needed for the privacy issue. So, that nobody can reply to my mail directly until I send any mail to them.

Ask your mail server administrator to setup an email forwarding for you.

This is not a Java specific question. What you are asking for is called an Email alias , and is a standard functionality on mail servers.

您可以使用伪造的“发件人:”字段和有效的“答复人:”字段,但是唯一会被此蒙骗的人是不知道如何发送垃圾邮件的人。

Even if you can (see below) mask the From field, you are giving away your email address in the Reply-To field, so you are still revealing your email address. (And if you weren't, it wouldn't be possible to reply.) So go with @Anony-Mousse and find a proper solution.

Now, please note that there are two "from" fields: one in the SMTP envelope and another in the message data.

It is quite uncommon for current mail servers to let you fake the SMTP from, though it may be possible if the server is using raw SMTP without authorization.

You are more likely to be allowed to send an email with a custom "From" in the message body (which is the one mail clients display, unless you look att all headers). However, the mail server may require that it matches the user you authenticated as.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM