aishwarya
aishwarya

Reputation: 1986

Send email with custom "from" address

In my open source and free online application, the tool allows people to send emails to their audience. For this purpose, I use java mail API and Gmail SMTP. However, when sending, the "from" address always is my account that I use to authenticate into Gmail and not the user's email address. This leads to a lot of confusion and problems.

I understand Gmail's philosophy to not allow this (to prevent abuse), but it is a serious limitation from my app's perspective.

Are there any free/ cheap online email services other than Gmail that allow programmatic interfacing and allow programs to send emails with a specified "from" address?

Upvotes: 2

Views: 2963

Answers (2)

Petr
Petr

Reputation: 63359

The hosting service for your application should provide you with a SMTP server that you should use to send emails. But as mentioned, forging From is the most common sign of spam and most likely such emails will be filtered out by spam filters or SMTP servers on the route.

Upvotes: 1

user1474090
user1474090

Reputation: 675

Why don't you set the reply-to address for the email so that the users still reply to the correct email address?

Therefore you keep the from address as your gmail address but set the reply-to address to be the users address.

Something like:

msg.setReplyTo(new InternetAddress("[email protected]"));

Upvotes: 1

Related Questions