2017-06-27 13 views
0

Ich versuche derzeit, ein Kontaktformular zu meiner Website hinzufügen, aber Postfix scheint nicht die Mail zu senden. Hier ist mein E-Mail-Testskript:PHP mail() nicht senden mail

<?php 

ini_set('display_errors', 1); 
error_reporting(E_ALL); 
$from = "[email protected]"; 
$to = "[email protected]"; 
$subject = "PHP Mail Test script"; 
$message = "This is a test to check the PHP Mail functionality"; 
$headers = "From:" . $from; 
mail($to,$subject,$message, $headers); 
echo "Test email sent"; 
?> 

Die Skript echo this out: Test email sent aber keine E-Mail gesendet wird. Ich überprüfe mein Postfix Mail-Protokoll und das ist, was ich sehe:

Jun 27 17:09:01 mbergwall2222 postfix/smtp[21196]: A0FDB41107: to=<[email protected]>, relay=none, delay=0.04, delays=0/0/0.03/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=mbergwall2222 type=A: Host not found) 
Jun 27 17:09:01 mbergwall2222 postfix/qmgr[1915]: A0FDB41107: removed 

Scheint, wie es möglicherweise ein Problem mit meinem Host-Namen sein. Wenn ich hostname in SSH zu tun, gibt es induce.tech (das ist richtig, das ist der Domain-Name ist mein Server auf Hier ist mein Postfix main.cf ist.

# 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. 

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated 
defer_unauth_destination 
myhostname = induce.tech 
alias_maps = hash:/etc/aliases 
alias_database = hash:/etc/aliases 
mydestination = localhost 
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 
mailbox_size_limit = 0 
recipient_delimiter = + 
inet_interfaces = loopback-only 
inet_protocols = ipv4 
local_transport = error:local delivery is disabled 
smtp_helo_name = $myhostname.example.com 

Hier sind meine zwei Host-Dateien:

/etc/hosts

# Your system has configured 'manage_etc_hosts' as True. 
# As a result, if you wish for changes to this file to persist 
# then you will need to either 
# a.) make changes to the master file in /etc/cloud/templates/hosts.tmpl 
# b.) change or remove the value of 'manage_etc_hosts' in 
#  /etc/cloud/cloud.cfg or cloud-config from user-data 
# 
127.0.1.1 induce.tech 
127.0.0.1 localhost 

# The following lines are desirable for IPv6 capable hosts 
::1 ip6-localhost ip6-loopback 
fe00::0 ip6-localnet 
ff00::0 ip6-mcastprefix 
ff02::1 ip6-allnodes 
ff02::2 ip6-allrouters 
ff02::3 ip6-allhosts 

/etc/hostname

induce.tech 

HINWEIS: Ich verwende Server-Pilot für die Systemsteuerung dieses Ubuntu-Servers!

Host: Digital-Ozean

Lassen Sie mich wissen, ob jemand helfen kann! Vielen Dank!

EDIT: Hier ist meine phpinfo(): Pastebin

EDIT2: Hier ist die richtige Protokolldatei:

[27-Jun-2017 17:03:50 UTC] mail() on [/srv/users/induce/apps/induce/public/portfolio/php/contact.php:9]: To: [email protected] -- Headers: From: [email protected] Reply-to: [email protected] -- Subject: test 
[27-Jun-2017 17:05:48 UTC] mail() on [/srv/users/induce/apps/induce/public/portfolio/php/contact.php:9]: To: [email protected] -- Headers: From: [email protected] Reply-to: [email protected] -- Subject: Test 
[27-Jun-2017 17:08:17 UTC] mail() on [/srv/users/induce/apps/induce/public/portfolio/php/contact.php:10]: To: [email protected] -- Headers: From:[email protected] -- Subject: PHP Mail Test script 
[27-Jun-2017 17:12:12 UTC] mail() on [/srv/users/induce/apps/induce/public/portfolio/php/contact.php:10]: To: [email protected] -- Headers: From:[email protected] -- Subject: PHP Mail Test script 
[27-Jun-2017 17:16:13 UTC] mail() on [/srv/users/induce/apps/induce/public/portfolio/php/contact.php:10]: To: [email protected] -- Headers: From:[email protected] -- Subject: PHP Mail Test script 
[27-Jun-2017 17:16:16 UTC] mail() on [/srv/users/induce/apps/induce/public/portfolio/php/contact.php:10]: To: [email protected] -- Headers: From:[email protected] -- Subject: PHP Mail Test script 
[27-Jun-2017 17:22:23 UTC] mail() on [/srv/users/induce/apps/induce/public/portfolio/php/contact.php:10]: To: [email protected] -- Headers: From:[email protected] -- Subject: PHP Mail Test script 
[27-Jun-2017 17:29:35 UTC] mail() on [/srv/users/induce/apps/induce/public/portfolio/php/contact.php:10]: To: [email protected] -- Headers: From:[email protected] -- Subject: PHP Mail Test script 

EDIT3: Hier ist die Ausgabe von postconf -n

alias_database = hash:/etc/aliases 
alias_maps = hash:/etc/aliases 
append_dot_mydomain = no 
biff = no 
inet_interfaces = all 
inet_protocols = all 
mailbox_size_limit = 0 
mydestination = $myhostname, induce.tech, mbergwall2222, localhost.localdomain, localhost 
mydomain = induce.tech 
myhostname = induce.tech 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 
myorigin = /etc/mailname 
readme_directory = no 
recipient_delimiter = + 
relayhost = 
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache 
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) 
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination 
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem 
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key 
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache 
smtpd_use_tls = yes 
+0

Sind Sie sicher, dass die Nachricht von diesem Skript stammt? Es sieht so aus, als würde es versuchen, eine lokale E-Mail an 'root @ mbergwall2222' zu senden. – aynber

+0

Wenn Sie auf Digital Ocean gehostet werden, sollten Sie bereits eingerichtet sein, um PHP-E-Mails zu senden. geben Sie ihrem Support-Team einen Anruf. – unixmiah

+0

Wie ist dein PHP konfiguriert? Überprüfen Sie http://www.php.net/manual/en/mail.configuration.php –

Antwort