Question
How to change the sender email address in the emails sent by root cron tasks to avoid a SPF validation failure?
Received-SPF: neutral (google.com: 203.0.113.2 is neither permitted nor denied by best guess record for domain of [email protected]) client-ip=203.0.113.2;
Answer
Change Plesk hostname to a domain with valid SPF records: How to change or get the server hostname on Plesk server
Alternatively, the following can be setup:
-
Connect to the server via SSH
-
Edit
myorigin
parameter inetc/postfix/main.cf
file:# egrep ^myorigin /etc/postfix/main.cf
myorigin = example.comNote: Where example.com is a domain with a valid SPF record. See What is the SPF? How to configure and use SPF on Plesk server? for more information.
-
Restart Postfix service:
# service postfix restart
Alternatively:
To add a parameter directly to the script, for example:
# vi /etc/cron.hourly/plesk-daily
#!/bin/sh
MAILFROM=”[email protected]”