-
-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] mail_from_force: force the "From" address to a fixed email #308
Comments
The problem here is that your mail server supports any address or enforce the main one. This is called "mail relay". We use Mailgun as mail provider with authorized domains. In a nutshell, it's not something of Odoo, but on the rest of the infrastructure. |
In this scenario, the mail server is configured according to a corporate policy, and I cant change any of them. So I need Odoo to "behave" accordingly. Additionally, from a security PoV I see the point for this policy of not "impersonating" someone else, and there are more companies out there using it. |
Yeah, but you can put whatever you want on your From, that mail server will change it. There's a middle solution that some mails servers do that is "X in the name of Y", but again is not in Odoo part, but on the mail server that allows that. |
It doesn't. It rejects the email message.
I researched that. My particular case is using MS Exchange.
Again, is this case I can't and I don't want to. |
Ok, if you think this can be solved that way, try and tell me. I remember to struggle with the same problem and MS exchange being a pain, finally using other smtp server. |
Update: My current fix is not strong enough: the SMTP server enforces that the Header "Sender" corresponds to the "From" in the message envelope. For mails to go through I need to ensure that both the Sender and the messages's From corresponds to the user connected to the SMTP server. The most relevant commit is: odoo/odoo@a4597fe and the relevant discussion on the Odoo framework is odoo/odoo#3347. It seems that there are some PRs trying to fix this in the core. |
This is what I was trying to explain you 😉 |
Olivier Dony wrote:
|
Using my own SMTP server is not something I want to do. |
For v10 and v12 another implementation was made:
Additional info at odoo/odoo#20911 I think we should go on with |
I missed that one, thanks for pointing it out. |
In some scenarios, the outgoing mail server enforces the "From" email address to be the one for User connected to the mail server.
This means that if I connect to the outgoing mail server using "admin", all sent emails must be from "admin@example.com", and an email From "daniel.reis@example.com" would be rejected by the mail server.
AFAICS this behavior is not configurable, so I'm preparing an extension to solve this:
The From would be changed to keep the sender's name, but use the Outgoing Mail user's address.
Following the example above, Daniel's email From would be something like "Daniel Reis admin@example.com" or "On behalf of Daniel Reis admin@example.com"
Technically, we just need to override the
_get_default_from
method ofmail.message
.The text was updated successfully, but these errors were encountered: