I have a problem with my web server sending out email from websites through postfix. I have server that is running Ubuntu 12.04.5 and using Apache webserver. I have installed virtualmin on the server which installed postfix. The web server part is running just fine but the emailing of contact forms is a problem on the site using the php function mail.
The server itself is not an email server. It does not host any email. However there are errors in the log file that say mail loops back to myself. Here is an entry from the log file.
Jan 12 21:20:37 postfix/smtp[19519]: 261BE184BE: to=<info@domainname.com>, relay=none, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for domainname.com loops back to myself
I did some research online that said you needed to add your domainname.com to your main.cf file for postfix and restart it. I did this and then I got the unknown user: info error from the mail log. I feel like that adding the domain name for mydomains in the main.cf file would be correct if I was using this as an email server. There is an MX record for the domainname.com that exists and points to a totally different server.
I am not sure how to fix the problem so that the email from the server actually looks up the MX record and sends to the appropriate email server. If this helps I have posted the main.cf file to look at:
# See /usr/share/postfix/main.cf.dist 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)
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
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
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.
myhostname = webserver.domainname.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = webserver.domainname.com, localhost.domainname.com, , localhost, newdomainname.com
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
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
allow_percent_hack = no
Thanks for any help on getting my email to be sent the correct email servers.