How to set from mail address other than smtp authentication mail in java mail - email

I am specifying "FROM" address usinf setFrom() method, But i still receive mails having "FROM" address of SMTP authentication mail id. and want to set the "FROM" address dynamically. which keeps changing. What is the RFC282 standard to achieve this.

The solution from google is this
Gmail lets you send messages with another of your email addresses listed as the sender instead of your Gmail address. This feature helps you manage multiple accounts from the Gmail interface; it works only if you already own the email account linked to the alternate address
Select the Accounts and Import tab (or Accounts tab, if you're using Google Apps).
Under Send mail as, click Add another email address.
In the 'Email address' field, enter your name and alternate email address.
Choose one of two options:
Use Gmail's servers to send your mail (this is easier to set up)
Use your other email provider's SMTP servers (we recommend this option for professional mail accounts or domains). Note for Google Apps users: Depending on your domain2 type, this feature may be disabled by default. Talk to your administrator if you have any questions.
If you choose to use Gmail's servers:
Click Next Step >> and then click Send Verification. Gmail will send a verification message to your other email address to confirm that you own it.
Open your other account and either click the link in the message Gmail sent or enter the confirmation code in the Accounts section of your Gmail settings.
For more info, follow the below link
https://support.google.com/mail/bin/answer.py?hl=en&answer=22370.
The overhead involved is that any new from address needs a alias to be set in Gamil authentication mail account. Its not suits for enterprise salable app.
Other solution is You can install a mail server (hmailServer). This server allows you to set the custom from address
If any body knows other solutions, please suggest me.

It's up to your mail server. Often mail servers will prevent you from using any From address other than your actual login name. This helps prevent spam. Depending on your mail server, there may be ways to convince it that you should be allowed to use other From addresses.

These are two different things that you are talking about:
The id that you are mentioning is part of smtp handshaking protocol which usually is mapped to "Return-path" field in mime-header.
Whereas the id that comes in "FROM" field which actually is displayed in mail-list is been appended by the mail server when u compose the mail.
So if you can modify the mime header then make sure that "FROM:" field contains the id that yuou want to set not the smtp authentication id.
btw its rfc822
Have worked for rediffmail technical team in order to develop and enhance smtp, pop and imap protocols

Its depends on your mail server and configuration setting

Related

Is it possible to use mailgun.com as a SMTP server for personal outgoing emails, including the correct error return emails?

I am using mailgun.com for occassional mass-mailings. Would it be possible to also use it for sending personal emails from me and my wife? The specific problem is that email errors (e.g. "Recipient not found on the server") are only available in the mailgun console and I'd like for them to be received as an error emails sent back to the sender (as is the case with "standard" personal email services). Is it possible to set this up at mailgun.com?
Alternatively, is there a cheap (or even free) SMTP server available for sending emails from the custom domain I own?
(Note that RECEIVING emails to our domain is not a problem, we have that solved using email redirection on my domain.)
Detailed explanation of our setup and reasoning: Behind the scenes, we are both using personail gmail accounts (e.g. me#gmail.com and wife#gmail.com) but we don't advertise these anywhere and our "public" email addresses are me#mydomain.com and wife#mydomain.com. Mydomain.com uses Cloudflare email redirection to redirect our incoming emails back to our Gmail inboxes. We used "Send mail as" GMail feature to send emails as "me#mydomain.com" and "wife#mydomain.com" through smtp.gmail.com but this solution requires us to have "Less secure apps" enabled on our Google accounts and Google seems to be phasing this solution out. The fact that our "real" Gmail addresses are visible in the email headers is not a problem for us.
Originally, we've used free "legacy" Google Workspace accounts on mydomain.com but those are now also being phased out by Google. So we are looking for a SMTP server.
Answering my own question:
I have found that smtp2go.com (which provides very similar services to mailgun.com) provides this option. Your SMTP account can be configured (in the "Advanced" tab) so that bounced email reports are delivered back to the sender's mailbox (or to different mailbox). Additionally, smtp2go's services are free if you send less than 1000 emails monthly so this seems like perfect solution to my problem.

Email bounced for one recipient

I have a simple SMTP service which sends mails to all my clients. Though all my clients from a particular organization receive my mail, only one individual mail bounces back.
PS : He receives mails from another email client on the same host.
I am unable to figure out if the error is on our side or just the email settings of that particular user.
The error on the bounced mail is:
553:Sender is on user denylist
I Want to be sure before replying to client that the error is on his/her email settings.
Yes, that appears to be a specific block rule on the recipient side.
It looks like they are using McAfee Email Protection. The user or admin will probably need to adjust some settings. According to this page the intended recipient can follow these instructions:
To manage user’s block list navigate to Account Management > Users >
double-click on user > Sender Deny.

Can Thunderbird choose the correct account?

I have a question about sending a mail with mozilla thunderbird. I have several email-addresses and i want thunderbird to choose a certain account when i send an email to a certain recipient.
For example I have two accounts: mail#myaddress.com and mail#anotheraddress.com
If I send an email thunderbird uses per default mail#myaddress.com. So far so good. Sometimes I have to send an email to companies, where I have to use mail#anotheraddress.com as sender address. If I forget to switch the account theses companies get mails from the wrong mail address. Is there a way to connect a recipient emailaddress to an certain account?
You can compose email using command line:
"preselectid" : an identifier for the "From" identity to choose from the menu*
note that you cannot directly specify an e-mail address but need to find the identity key
for example, "preselectid=id2" would select the identity #2
Reference:http://kb.mozillazine.org/Command_line_arguments_%28Thunderbird%29

sendmail disabled

My host has Sendmail() disabled. I'm basically looking for a way to bypass this. I want visitors to be able to send me (gmail account) an email where they first fill in their e-mail address, so they become the sender. It's for support questions and remarks.
If there is no way to bypass this, is there and alternative, perhaps using mailchimp..?
You can always use an alternative public send mail servers available. You can use one of them. Here is one Public Send Mail server list
use phpmailer library. you can send email via connecting smtp (works with gmail too.) 1st configure one of your accounts with phpmailer. when the user fills in their email set the sender as user's email.
even though you are actually sending the email through your account to receiver of the email will show as sent by user's email address.
http://phpmailer.worxware.com/

What's the best way to allow a web based e-mail system send replies and bounces to the sender's personal e-mail address?

I have a web app that only registered users can use, therefore I should have a valid e-mail address for the creator of the message.
One part of this web app will allow a user to create and send a e-mail message to an e-mail address that the user enters. My web server will be creating and sending the e-mail, however if there is a delivery problem with the e-mail I would like the bounce to go to the user's e-mail address instead of the server. This will allow the user to know that there was a problem delivering the message and they can take the appropriate action.
Would setting the "return-path" attribute to the user's e-mail address handle this?
As RFC2821 says:
The primary purpose of the Return-path is to designate the address to which messages indicating non-delivery or other mail system failures are to be sent. For this to be unambiguous, exactly one return path SHOULD be present when the message is delivered.
So yes, all standard compliant servers should account for the Return-path you set.
You could set up windows service on your server to periodically check BadMail folder and parse the bounced messages and resend them to the original sender. This solution would work in most cases. I don't think return-path would help in every instance (if it would at all), because different mail servers handle bounces differently.