Score:0

Postfix SPF mailfrom

ma flag

I've setup postfix on my VPS Ubuntu 18.04 and I've followed guides to setup DKIM, DMARC and SPF. I have multiple domains on the server and I'm trying to send email from a domain which is not the same as my hostname. (sending via php mail() function)

I have sent an email to Gmail and I've got 3 passes:

       dkim=pass [email protected] header.s=default header.b="xxxxxx/M";
       spf=pass (google.com: domain of [email protected] designates 11.22.33.44 as permitted sender) [email protected];
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=second-domain.com

I think Gmail is giving me a pass on SPF because of IP validation.

Checked my email score with mailgenius.com:

(-2 points) Your "from" address does not match your SPF "from" address.
Solution:
Make sure your SPF authentication is setup correctly so your SPF from domain matches the from domain in your emails.

Your From domain is: second-domain.com
Your SPF MailFrom domain is: hostname.com

I don't know where to modify postfix to change the spf mailfrom to match the sender domain and not the hostname? Is it possible to do so?

edit: setting up smtp_generic_maps in main.cf does change those values:

smtp_generic_maps = hash:/etc/postfix/generic

/etc/postfix/generic:

[email protected] second-domain.com

That does change the output and kinda works. That is just hard-coded for one domain.I need to detect which domain is used to replace [email protected]

anx avatar
fr flag
anx
Trying to fix up mail after submission is treating symptoms. Instead, configure your mail senders to use the correct addresses. Possibly not [using the php built-ins](https://serverfault.com/questions/917861/sendmail-exim-or-php-mail-settings-to-avoid-sender-address-rejected-domain-n) but instead submit mail like any external MUA would: authenticated submission via SMTP.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.