I'm having a problem with my formmail on my VPS. Centos 6.4 64 bit, Postfix. Webmail and outlook mail (smtp/pop3) are working fine. Sending and receiving email is working. When I try to send emails from formmail.php the mail is not sent. I've added a test line in my formmail.php. The page is redirecting which is a confirmation that the mail was sent. If the mail was not sent I should receive the error message. if (mail($recipient, $subject, $message, "FROM: $email") ) { header("Location: sent.html"); } else { echo "email could not be sent"; }
You may want to check your MTA logs to verify that the email was indeed sent. Also, you may want to format your header like so: <?PHP $default_from_name = "Some name here"; $headers = "From: {$default_from_name} <{$email}>\r\n"; if (mail($recipient, $subject, $message, $headers)) { header("Location: sent.html", 200); } else { echo "Email could not be sent"; } ?> Code (markup):
Thanks for your help. I'm making some progress but still not working. here is the latest message from my mail log. Can someone tell me what the problem might be? Jun 10 13:36:06 server1 postfix/pickup[776]: DD8CC58428F5: uid=48 from=<apache> Jun 10 13:36:06 server1 postfix/cleanup[848]: DD8CC58428F5: message-id=<> Jun 10 13:36:06 server1 postfix/qmgr[777]: DD8CC58428F5: from=<>, size=350, nrcpt=1 (queue active) Jun 10 13:36:07 server1 postfix/smtp[784]: DD8CC58428F5: to=<>, relay=xxxxxxxx.com[xx.xx.xx.xx]:25, delay=0.28, delays=0.01/0/0.25/0.01, dsn=4.0.0, status=deferred (host xxxxxxxx.com[xx.xx.xx.xx] said: 451 Temporary local problem - please try later (in reply to RCPT TO command))
That sounds like the message is getting filtered on the other end. With the redacted logs, I can't tell much. I might suggest running a blacklist check using http://multirbl.valli.org and give it your server's primary IP address, and see what it says.
Yes, i can ping the destination server from my mail server. I have discovered one thing though. PHP mail sends ok from my host domain. It seems that only on virtual hosts that is isn't sending. I still have no idea why.
Here is main.cf # postfix config file # uncomment for debugging if needed soft_bounce=yes # postfix main mail_owner = postfix setgid_group = postdrop delay_warning_time = 4 # postfix paths html_directory = no command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix queue_directory = /var/spool/postfix sendmail_path = /usr/sbin/sendmail.postfix newaliases_path = /usr/bin/newaliases.postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man sample_directory = /usr/share/doc/postfix-2.2.2/samples readme_directory = /usr/share/doc/postfix-2.2.2/README_FILES # network settings inet_interfaces = all mydomain = xxxxxx.com myhostname = control.xxxxxxg.com mynetworks = all mydestination = localhost.$mydomain, localhost relay_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-relay_domains_maps.cf # mail delivery recipient_delimiter = + # mappings alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases transport_maps = hash:/etc/postfix/transport #local_recipient_maps = # virtual setup virtual_alias_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_alias_maps.cf, regexp:/etc/zpanel/configs/postfix/virtual_regexp virtual_mailbox_base = /var/zpanel/vmail virtual_mailbox_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_domains_maps.cf virtual_mailbox_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_mailbox_maps.cf virtual_mailbox_limit_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_mailbox_limit_maps.cf virtual_minimum_uid = 101 virtual_uid_maps = static:101 virtual_gid_maps = static:12 virtual_transport = dovecot dovecot_destination_recipient_limit = 1 # debugging debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5 # authentication smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous smtpd_sasl_local_domain = $myhostname broken_sasl_auth_clients = yes smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth # tls config smtp_use_tls = no smtpd_use_tls = no #smtp_tls_note_starttls_offer = yes #smtpd_tls_loglevel = 1 #smtpd_tls_received_header = yes #smtpd_tls_session_cache_timeout = 3600s #tls_random_source = dev:/dev/urandom #smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache # Change mail.example.com.* to your host name #smtpd_tls_key_file = /etc/pki/tls/private/mail.example.com.key #smtpd_tls_cert_file = /etc/pki/tls/certs/mail.example.com.crt # smtpd_tls_CAfile = /etc/pki/tls/root.crt # rules restrictions smtpd_client_restrictions = smtpd_helo_restrictions = smtpd_sender_restrictions = smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain # uncomment for realtime black list checks # ,reject_rbl_client zen.spamhaus.org # ,reject_rbl_client bl.spamcop.net # ,reject_rbl_client dnsbl.sorbs.net smtpd_helo_required = yes unknown_local_recipient_reject_code = 550 disable_vrfy_command = yes smtpd_data_restrictions = reject_unauth_pipelining