Wie kann ich mit PHP mail() zu arbeiten? Brauche Hilfe bei der Konfiguration eines MTA
Update: ich habe es gelöst. Alles dokumentiert unter.
Ich habe versucht, so viele Dinge, aber es einfach nicht funktionieren würde.
Ich würde nicht dagegen, mit, postfix, exim4 oder sendmail. Ich muss nur eine Schritt-für-Schritt-Anleitung und Erklärung, was mache ich. Ich bin auch über Google Apps für e-mail.
Edit:
mail.melden Sie
Nov 3 01:14:02 mugbear postfix[16615]: error: to submit mail, use the Postfix sendmail command
Nov 3 01:14:02 mugbear postfix[16615]: fatal: the postfix command is reserved for the superuser
Was bedeutet das?
Update edit: Behoben, indem korrigiert wird, wie sendmail_path in php.ini mit sendmail_path = /usr/sbin/sendmail -t -i
Edit2:
PHP - schnappte sich Einfach von Dokumentation. FYI, ich entfernte meine e-mail.
<?php
//The message
$message = "Line 1\nLine 2\nLine 3";
//In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
//Send
mail('[email protected]', 'My Subject', $message);
?>
Edit3:
Ein weiterer Fehler:
Nov 3 07:22:29 mugbear postfix/postdrop[17131]: warning: unable to look up public/pickup: No such file or directory
Nov 3 07:22:29 mugbear postfix/postdrop[17133]: warning: unable to look up public/pickup: No such file or directory
Update edit3: wurde dieser mit dem folgenden link: http://ubuntuforums.org/showthread.php?t=666018
Dies ausführen:
sudo mkfifo /var/spool/postfix/public/pickup
sudo /etc/init.d/postfix restart
Danach werden Sie diese Fehlermeldung erhalten:
postfix/master[13902]: fatal: bind 0.0.0.0 port 25: Address already in use
Dann haben Sie überprüfen Sie Ihre Prozesse und töten sendmail-Prozesse, zum Beispiel:
root@server:/etc/postfix# ps aux | grep mail
root 23554 0.0 0.0 8232 1900 ? Ss 10:17 0:00 sendmail: MTA: accepting connections
root 27308 0.0 0.0 3004 764 pts/0 S+ 10:30 0:00 grep mail
root@server:/etc/postfix# kill 23554
Edit4:
Was bedeutet das?
Nov 3 07:34:51 mugbear postfix/pickup[17309]: 6602F1C151: uid=33 from=<www-data>
Nov 3 07:34:51 mugbear postfix/cleanup[17311]: 6602F1C151: message-id=<20101103073451.6602F1C151@mugbear.xen.prgmr.com>
Nov 3 07:34:51 mugbear postfix/qmgr[17310]: 6602F1C151: from=<www-data@mugbear.com>, size=397, nrcpt=1 (queue active)
Nov 3 07:34:51 mugbear postfix/error[17321]: 6602F1C151: to=<mugbear@gmail.com>, relay=none, delay=0.03, delays=0.02/0/0/0.01, dsn=4.3.5, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=xen.prgmr.com type=A: Host found but no data record of requested type)
Update edit4: ich lief dpkg-reconfigure postfix
und ausgewählten Internet Site
.
Du musst angemeldet sein, um einen Kommentar abzugeben.
hast du richtig installiert ist postfix ? Wenn ja :
service postfix restart
nano /etc/php.ini
Finden sendmail_path , ändern Sie die Zeile sendmail_path = /usr/sbin/sendmail.postfix -t -ich
Hier ist die komplette client - /server-Installationsanweisungen für php-client auch http://setahost.com/installing-postfix-as-a-default-mail-sending-program-with-php/
Folgen-client-installation-Anweisungen ...
Was nicht funktioniert? Was haben server logs zeigen (sowohl für PHP und mail)? Sie müssen herausfinden, ob das problem ist mit PHP oder MTA.
IMHO, einrichten der send-nur postfix und dann mit den PEAR-Mail-Bibliothek ist wahrscheinlich die beste Wette.