Skip to content
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

how can change smtp.mailfrom #354

Open
Hesammousavi opened this issue Nov 6, 2023 · 6 comments
Open

how can change smtp.mailfrom #354

Hesammousavi opened this issue Nov 6, 2023 · 6 comments

Comments

@Hesammousavi
Copy link

Hesammousavi commented Nov 6, 2023

ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass [email protected] header.s=ml header.b=hl8HLq7F;
       dkim=pass [email protected] header.s=ml header.b=m4zllZXe;
       spf=pass (google.com: domain of [email protected] designates 185.249.220.144 as permitted sender) [email protected];
       dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=roocket.ir
Return-Path: <[email protected]>

Hello everyone, I've been extensively exploring the code of the Zone MTA, but I'm having difficulty figuring out how to change the 'smtp.mailfrom' setting. In the provided code snippet, you can see that mlsend.com is sending marketing emails, and the 'smtp.mailfrom' setting is affecting the 'Return-Path.' However, I'd like to set 'smtp.mailfrom' differently while keeping the 'From' envelope as '[email protected].' It's important to note that when I create a user with the name '[email protected],' the sending email still uses '[email protected]' as the 'From' address. Could you please provide guidance on how to achieve this within the Zone MTA code?

@Hesammousavi
Copy link
Author

@andris9
do you have any solution for this ?

@louis-lau
Copy link
Contributor

louis-lau commented Nov 12, 2023

I'd like to set 'smtp.mailfrom' differently while keeping the 'From' envelope

Your question is a little confusing to me. Smtp.mailfrom, envelope-from, and return-path are all the exact same thing, aren't they? They all refer to the value of MAIL FROM during the SMTP transaction. You can't set things to a different value if they refer to the same thing.

@louis-lau
Copy link
Contributor

For context, there's a total of 2 from addresses. The one on the message itself, and the one used during the SMTP transaction.

@Hesammousavi
Copy link
Author

Hesammousavi commented Nov 13, 2023

@louis-lau
1
Screenshot 2023-11-13 081230
Screenshot 2023-11-13 081312

Thank you for your response. I appreciate your attempt to clarify, and I'd like to provide more details to ensure we're on the same page.

In the context of email authentication, specifically DKIM (DomainKeys Identified Mail) and DMARC (Domain-based Message Authentication, Reporting, and Conformance), there are distinctions between 'mailed-by' and 'signed-by' elements.

The screenshot you attached indeed highlights the 'mailed-by' information, indicating the domain responsible for sending the email. However, the 'signed-by' information refers to the domain that has digitally signed the message using DKIM.

In my initial question, I'm specifically interested in changing the 'mailed-by' information in the Return-Path, which is often associated with the 'smtp.mailfrom' or 'envelope-from' address. This can impact how email providers display the sender information to recipients.

For instance, in the provided email header snippet:

plaintext
Copy code
Return-Path: [email protected]
The 'mailed-by' or 'envelope-from' domain is 'mlsend.com.' My goal is to configure this 'mailed-by' domain, while still keeping the 'From' address in the email body as '[email protected].'

I've noticed that some email marketing platforms, like MailerLite, allow users to customize the 'mailed-by' domain. This customization can contribute to better email deliverability and brand consistency.

If possible, could you guide me on how to achieve this within the Zone MTA code? I'm interested in changing the 'mailed-by' or 'envelope-from' domain without altering the 'From' address in the email body.

I hope this clarifies my inquiry, and I appreciate your assistance in navigating this matter.

Best regards,

@louis-lau
Copy link
Contributor

louis-lau commented Nov 13, 2023

Sure, so you mean you want to set the envelope from? I think you can just write a plugin that sets envelope.from. The envelope object is available in multiple hooks.

You still seem to be over complicating this. Spf and dkim are checked against the envelope from. So yes, the envelope from domain will be in mailed by and signed by. Otherwise they would not be valid.

Do note that this setup will make your service incompatible with a strict dmarc policy. As with a strict dmarc policy requires the envelope from and the from header domain to be the same. If you use this setup and your customer co figured strict dmarc, all emails will bounce. Just as long as you're aware of that it should be fine.

@louis-lau
Copy link
Contributor

You should probably just make it the same as the from header though, and tell your customers how to set up dkim, spf, dmarc. A strict dkim policy leads to better security for your customers, as it prevents from spoofing of their domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants