Etc/mailname value

Hi folks,


Ubuntu 18.04
Virtualmin 6.09.gpl
PHP version 7.2.31
Apache 2.4.29

I created a Virtual Server - HTTP, HTTPS & Mail and everything behaves as expected.

I then created a Virtual Server - just HTTP & HTTPS, which displayed the content as expected. One page has a contact form so I tested it. The mail log received errors as below

Jun 28 21:32:23 myHost postfix/qmgr[28860]: BDE2047D3C: from=virtualserver@myHost, size=456, nrcpt=1 (queue active)
Jun 28 21:32:24 myHost postfix/smtp[8390]: BDE2047D3C:,[]:25, delay=0.45, delays=0.07/0.01/0.35/0.02, dsn=5.0.0, status=bounced (host[] said: 501 Syntax error in parameters or arguments (in reply to MAIL FROM command))

the postfix looked as expected.

#See /usr/share/postfix/ for a commented, more complete version

#Debian specific: Specifying a file name will cause the first
#line of that file to be used as the name. The Debian default
#is /etc/mailname.
#myorigin = /etc/mailname

#smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_banner = $myhostname ESMTP $mail_name
biff = no

#appending .domain is the MUA’s job.
append_dot_mydomain = no

#Uncomment the next line to generate “delayed mail” warnings
#delay_warning_time = 4h

readme_directory = no

#See – default to 2 on
#fresh installs.
compatibility_level = 2

#TLS parameters
smtpd_tls_cert_file = /etc/postfix/postfix.cert.pem
smtpd_tls_key_file = /etc/postfix/postfix.key.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

#See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
#information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname,,, localhost, myHost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
#inet_protocols = all
inet_protocols = ipv4
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_rhsbl_helo, reject_rhsbl_reverse_client, reject_rhsbl_sender, reject_rbl_client, check_sender_access hash:/etc/postfix/sender_access, check_policy_service unix:private/policyd-spf
smtp_tls_security_level = dane
smtpd_tls_CAfile = /etc/postfix/
smtpd_tls_security_level = may
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unknown_sender_domain, reject_unknown_reverse_client_hostname, reject_unknown_client_hostname, check_sender_access hash:/etc/postfix/sender_access
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_invalid_hostname, permit
smtpd_helo_required = yes
smtpd_client_restrictions = permit_mynetworks reject_unknown_reverse_client_hostname permit_sasl_authenticated reject_rbl_client reject_rbl_client reject_rbl_client
disable_vrfy_command = yes

I came across a few posts on the forums here that pointed me to look at /etc/mailname.

Running a hostname command returns myHost - which is similar to my working (but outgoing VPS - Ubuntu 16, moving to 18), i.e. it isn’t a FQDN.

Checking the /etc/mailname between both VPSs - the new (misbehaving one) had myHost whereas the outgoing one had a FQDN.

On the new VPS - I’ve set the value to a FQDN in etc/mailname, reloaded Postfix Config (and restarted it for good measure) and I no longer receive the error and mail turns up on the other end.

But - I’m a bit stumped as to why one has a FQDN and another doesn’t (or didn’t).

The contact form is using PHP Mail and the headers (FROM, etc) are and were correctly being set.

Thanks for advance