How to send e-mail as coming from logged-in user’s own email address instead of email_id present in Email Account setup?
I am checking this option, always_use_account_email_id_as_sender=1 but still email is being send as email_id present in Email Account Setup not as logged_in user email address.
How to send e-mail as coming from logged-in user’s own email address instead of email_id present in Email Account setup?
This will be possible with Email Inbox feature of version 8. It is currently under development and scheduled for release later this week.
I am checking this option, always_use_account_email_id_as_sender=1
but still email is being send as email_id present in Email Account
Setup not as logged_in user email address.
For now, system only does masking. The name of the sender is updated in the From field, but reply-to address is one mentioned in the Email Account. That’s because ERPNext has login credentials for the Account mentioned in the Email Account, and not of user’s email account.
Apparently all “replies” goes through user emails. But when you compose a new mail through Email Inbox (->New) it sends through system mail instead of user mail.
I have version erpnext version 12. I have correct set up for Email Inbox. Still When I log in and Click on New Email button to send email. Emails are still sent from default outgoing email.
I’m facing the same issue on a small ERPNext instance (up-to-date v15, hosted on Frappe Cloud).
When I added a test Gmail account in the beginning, it worked well to send all email through that account. Then I tried to add our own Gmail domain and since then I’m unable to get it working again.
Our email server rejects emails sent from ERPNext with personal sender information due to security policies. I can’t figure out how to get the system to respect the following two options (which are enabled) for our single configured email account:
Always use this email address as sender address
Always use this name as sender name
Update
After more debugging, I found that the “Communications” information is misleading. It shows my personal email address as “From” in the “To and CC” section. In the “Email Queue”, the technical information shows that the email has been sent from the service email address. This means that the two checkboxes are respected.
However: While the “From” in the email header shows the service address, the header also contains my personal email address in the X-Original-From attribute. This makes the email fail our security checks. I’m not sure how to fix this except modifying the source code to remove the X-Original-From tag.
Email header
Content-Type: multipart/mixed; boundary="===============5144953897453543427=="
MIME-Version: 1.0
Message-Id: <17370239*******55554374@bitbox.erpnext.com>
X-Original-From: Myself <personal@company.com>
Subject: Purchase Order PUR-ORD-2025-00011
From: Company Backoffice <backoffice@company.com>
To: test@domain.com
Date: Thu, 16 Jan 2025 10:39:20 -0000
Reply-To: backoffice@company.com
X-Frappe-Site: https://company.erpnext.com
Error
5.7.26 Unauthenticated email from company.com is not accepted due to
5.7.26 domain's DMARC policy. Please contact the administrator of
5.7.26 company.com domain if this was a legitimate mail. To learn about
5.7.26 the DMARC initiative, go to
5.7.26 https://support.google.com/mail/?p=DmarcRejection d75a77b69052e-46c87417efasi166797331cf.559 - gsmtp
Emails created by personal@company.com will be sent from the same address only if a valid Email Account is set up for it. Otherwise, they will be sent from the default outgoing account, backoffice@company.com.
To ensure emails are sent from personal@company.com, you need to set up a valid Email Account for it. This will allow the system to select the correct account instead of defaulting to the generic one.
As for the DMARC error, it is likely caused by your domain’s reject policy and a failed DMARC check. This failure could be due to misalignment in SPF or DKIM records.
The default Email Account has permission to send emails on behalf of other addresses. If the default Email Account (e.g., backoffice@company.com) is authorized by your ESP (Email Service Provider) to send emails from personal@company.com, then disable the “Always use this email address as sender address” option in your Email Account. The From header should be set as the actual sender’s email personal@company.com.
The default Email Account lacks permission to send on behalf of other addresses. If backoffice@company.com doesn’t have the required permissions to send emails from other addresses like personal@company.com, you’ll need to create a separate Email Account for each user or address.
We already have a full Google Workspace setup for all our employees, but these are not relevant for ERPNext. We neither want to authorize ERPNext to send on these users’ behalf, nor do we want to expose the email addresses to external parties in emails sent by ERPNext.
For testing, I tried to allow backoffice@company.com to send on behalf of personal@company.com (and vice-versa), but couldn’t get it to work. But in any case, that’s not what we want.
We just want ERPNext to use its own email account for outgoing and incoming emails.
Please correct me if I’m wrong: You want all emails sent from backoffice@company.com on behalf of all users, but you don’t want the X-Original-From header included.
If that’s the case I would suggest raising a PR making it configurable in the Email Account and letting the user decide whether to add it or not, defaulting to 1.
Correct. I don’t see why the X-Original-Form field is even required. It feels highly unusual to expose this user metadata information externally, and it complicates simple email setups.