試圖通過SMTP發送電子郵件,它不工作,任何幫助?電子郵件:SMTP和PHP
//SMTP info
$host = "smtp.gmail.com";
$username = "[email protected]";
$password = "password";
$from = "Taylor";//From email address
$to = "[email protected]";//Change this to your inbox
$headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject);
// HTML email
//$headers .= "MIME-Version: 1.0" . "\r\n";
//$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password));
//Send to you
$mail = $smtp->send($to, $headers, $message);
if (PEAR::isError($mail)) {
echo("<h1>** Whoops! Error!. **</h1> <p>Please call us instead.</p>");
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<h1>Thank you for your inquiry!</h1> <p>Thank you for signing up for our event. Your request for our guestlist has been received. Please check your email for the confirmation.</p> ");
}
我該怎麼做:S歡呼隊友欣賞它 – user195257 2009-10-23 20:28:42
查看您的PHP環境變量,然後找到日誌位置並使用文本查看器打開它。滾動到最後,應該在那裏記錄一些錯誤。如果您在Windows中可能位於C:\ PHP5 \ Logs \,並且在Linux中,它可能位於/ var/log /中。 – Scooterville 2009-10-23 21:00:47