2012-03-29 30 views
-1

這是應該(在我的PHP代碼)發送郵件:切勿從形式 - 的Gmail收發電子郵件

$message = 
"Hello \n 
Thank you for registering with us. Here are your login details...\n 

User ID: $user_name 
Email: $usr_email \n 
Passwd: $data[pwd] \n 

"; 

mail($usr_email, "Login Details", $message, 
"From: \"Member Registration\" <[email protected]>\r\n" . 
"X-Mailer: PHP/" . phpversion()); 

header("Location: thankyou.php"); 
exit(); 

和我sendmail.ini

[sendmail] 

smtp_server=smtp.gmail.com 
smtp_port=25 
error_logfile=error.log 
debug_logfile=debug.log 
[email protected] 
auth_password=xxxxxxx 
[email protected] 

我是初學者所以這可能是完全錯誤的。 當我提交郵件功能的表單時,thankyou.php頁面顯示爲指定

+5

Gmail不接受端口25上的郵件。它必須是端口587上的SSL/TLS。 – 2012-03-29 20:28:12

+2

請參閱[this](http://stackoverflow.com/questions/712392/send- email-using-gmail-smtp-server-from-php-page),[許多其他](http://stackoverflow.com/search?q=gmail+smtp+%5Bphp%5D&submit=search).... – 2012-03-29 20:29:29

回答

0

嘗試phpMailer。您沒有正確組建郵件以便被Google接受...使用此班級發送標準郵件。