I am using kumoMTA as relay server, therefore whenever the user sending the mail changes I want my return path to change as well.
For example- A user named ‘patrick’ is sending a mail then the return path should appear as- patrick@example.com
Here example.com refers to my main mail server domain.
If the sending user changes so should the return-path.
For now I am using this configuration in my init.lua to keep it static.
kumo.on(‘smtp_server_message_received’, function(msg)
queue_helper:apply(msg)
local DOMAIN = “mail-10.growl.com”
local mail_from_domain = msg:from_header().domain
local signer_relay = kumo.dkim.rsa_sha256_signer {
domain = DOMAIN, – Domain of the relay server
selector = ‘dkim’, – Selector for the DKIM key of the relay server
headers = {‘From’, ‘To’, ‘Content-Type’, ‘Message-Id’, ‘Subject’}, – Headers to be signed
– headers = {‘From’, ‘To’, ‘Subject’, ‘Date’},
key = ‘/opt/kumomta/etc/dkim/growl.com/dkim.key’, – Path to the relay server’s private DKIM key
}
– Sign the message using the relay server’s DKIM signer
if signer_relay then
msg:dkim_sign(signer_relay)
else
kumo.log(‘error’, ‘Failed to initialize DKIM signer for growl.com’)
end
local tenant = msg:get_first_named_header_value ‘X-Tenant’
if tenant then
msg:set_meta(‘tenant’, tenant)
end
msg:set_sender(string.format(‘user1@%s’, DOMAIN))
end)
Also it would be great if I could use my main server domain here instead of relay server domain, that too without affecting the “mailed-by” header of the mail.
Hey there @helpful-emu, thanks for posting. Please read the “Troubleshooting” and “How to Ask for Help” buttons below. If you would like a 1:1 support session from the KumoMTA team, details are at the “Book a Support Session” button below.
Since I want a different mailed-by in the mail headers, I have to explicitly define the return path. Or I get the same mailed-by and signed-by which I do not desire. If I remove this
" msg:set_sender(string.format(‘user1@%s’, DOMAIN))"
then I get the desired return path but then the same mailed-by and signed-by.
Both of these things are intertwined and I want them to work independently of each other.
My mail chain starts from a main mail server configured for inbound and outbound mailing. It relays outbound mail from KumoMTA but takes inbound mail directly. Further KumoMTA uses a socks proxy and rotates two IPs for final mail delivery.
Still curious what is adding the “Mailed By” header. AFAIK, that is a header added by gmail. Are you saying you want your MTA to alter the mail in a way that makes gmail add a different “mailed-by”?
If I set a fixed return path then I can get a desired “mailed-by” but I don’t want the return path to be fixed/static, It should change according to the user sending the mail.
So can I at least make it to change the user of return-path?
Example-
sender is- patrick@showx.com
So I can set a static Return-Path- User1@first.com
So here not the domain but only the user should change ie It should show the return path as this → patrick@first.com
If the sending user is “Alex” then the return path should be → alex@first.com.