Question
- How to configure MSMTP to use the website domain name instead of the server hostname while sending emails?
Answer
It is not possible to adjust MSMTP settings concerning domains via the Plesk GUI yet, however such a feature request already exists and you may vote for it on the following link:
Allow configuration of MSMTP (SMTP relay) – Your Ideas for Plesk
Top-ranked suggestions are likely to be implemented in future versions of Plesk Obsidian.
As workaround, it is possible to configure MSMTP to send messages from a specific email address that belongs to a domain on the Plesk server by following these steps:
-
Log in to Plesk server via SSH
-
Open
/etc/msmtprc
in text editor and disableauto_from
parameter and addfrom
header with desired mail address:auto_from off
from [email protected]
When the auto_from
is disabled, it is required to explicitly specify a sender email address via the -f
(from
) option. For example:
# echo "Test Email" | sendmail -f [email protected] [email protected]
Warning: Notifications from Plesk will not be sent if from
[email protected] is not specified while the with auto_from
parameter is disabled. Even with from
specified in /etc/msmtprc
, it is still required to add the from
mail address explicitly as shown in the command above.