How to configure MSMTP to use the website domain name instead of the server hostname while sending emails?

Comments

1 comment

  • Avatar
    Jeremy Navick (Edited )

    Please be aware that saving the external SMTP settings page will overwrite your changes in /etc/msmtprc

    @see https://talk.plesk.com/threads/change-hostname-for-outgoing-mail-with-msmtp.364553/

    @workaround
    edit /usr/local/psa/admin/sbin/msmtpmng

    mc_generate_msmtp_config()
    {
           local hostname="`hostname -f`"

           printf "${AUTOGENERATED_CONFIGS}\n"
           cat <<-EOT
                   # MSMTP configuration file. See msmtp(1) for syntax.
                   # This file was generated by $prog utility.

                   #
                   # Global settings section
                   #
                   defaults

                   syslog LOG_MAIL

                   tls_certcheck off
                   tls $opt_tls

                   # Automatic envelope-from generation.
                   # Caution: this overrides explicitly set envelope-from via --from.
                   #from %U@$hostname
                   from $opt_auth_user
                   allow_from_override off

                   # This command sets the argument of the SMTP EHLO (or LMTP LHLO) command.
                   domain $hostname

     

    0

Please sign in to leave a comment.

Have more questions? Submit a request