Sie SMTP
Sie können auf Ihrem Server Ziemlich einfach verwenden Setup zu dem Googles Server frei SMTP konfigurieren müssen sie ändern.
<?php
$mail = new PHPMailer(true);
//Send mail using gmail
if($send_using_gmail){
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "your-gmail-password"; // GMAIL password
}
//Typical mail data
$mail->AddAddress($email, $name);
$mail->SetFrom($email_from, $name_from);
$mail->Subject = "My Subject";
$mail->Body = "Mail contents";
try{
$mail->Send();
echo "Success!";
} catch(Exception $e){
//Something went bad
echo "Fail :(";
}
?>
Sie können auch unten versuchen.
Sie können Mail von localhost mit sendmail-Paket senden, sendmail-Paket ist in XAMPP inbuild. Wenn Sie also XAMPP verwenden, können Sie einfach Mail von localhost senden.
zum Beispiel können Sie konfigurieren C:\xampp\php\php.ini
und c:\xampp\sendmail\sendmail.ini for gmail to send mail.
in C :\xampp\php\php.ini find extension=php_openssl.dll
und entfernen Sie das Semikolon aus dem Anfang der Zeile SSL arbeiten für gmail für localhost zu machen.
in der php.ini-Datei [Mail-Funktion] finden und
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = [email protected]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
Now Open C:\xampp\sendmail\sendmail.ini. Replace all the existing code in sendmail.ini with following code
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=my-gmail-password
[email protected]
// Mail-Funktion
[email protected]
mail($mail, 'Subject', 'sample mail', 'From: [email protected]');
zeigen Sie uns Ihren PHP-Code ... –
überprüfen Sie es bitte @ J.Zend ich bearbeite meine Frage – mickey
hast du irgendeine Fehlermeldung erhalten? –