Ich bin neu bei php. Ich habe versucht, Mail von PHP mit diesem Code zu senden.php send mail von localhost
<?php
$to = '[email protected]';
$subject = 'The subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
Ich habe ändern Einstellungen in der php.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = [email protected]
& in sendmail.ini
# A freemail service example
account Gmail
tls on
tls_certcheck off
host smtp.gmail.com
from [email protected]
auth on
user [email protected]
password xxxxxxxxx
# Set a default account
account default : Gmail
Jetzt Code läuft erfolgreich, aber ich bin keine Post bekommen.
Sie müssen den Mailserver auf localhost installieren. [PHPMailer] (http://sourceforge.net/projects/phpmailer/) – Bora
@Bora: Ich denke, es ist möglich, die Gmail oder Yahoo SMTP Mail-Server stattdessen hinzufügen. Ist es nicht? –
oder verwenden Sie einen Remote-SMTP-Server, wie GMAIL –