0
我試圖使用PEAR的Mail.php到通過的cPanel郵件服務器使用SMTP發送電子郵件(託管服務器上運行)梨(SMTP)Mail.php不會發送,沒有錯誤
腳本與郵件服務器位於同一臺服務器上。
我越來越沒有錯誤,但我還沒有得到任何郵件,我不知道爲什麼:/
我的代碼:
Email.php
<?php
ini_set("include_path", '/home/gamerfin/php:');
require_once "Mail.php";
class Email{
function mailClient(){
return Mail::factory('smtp', array(
'host' => 'ssl://mail.gamerfinder.net',
'port' => '465',
'auth' => true,
'debug' => true,
'username' => '[email protected]', //your gmail account
'password' => '*********' // your password
));
}
function send(){}
function newMessageMail($sender, $email, $message){
echo $email;
$smtp = self::mailClient();
$from = '[email protected]'; //change this to your email address
$to = $email; // change to address
$subject = 'New Message from '.$sender; // subject of mail
$body = "You have recieved a new message from ".$sender."<br>Message:<br>".$message; //content of mail
$headers = array(
'From' => $from,
'To' => $email,
'Subject' => $subject
);
$mail = $smtp->send($to, $headers, $body);
var_dump ($mail);
}
}
?>
任何人都可以看到我可能會出錯的地方嗎?
我看其他問題,並嘗試了一些自己的答案,但沒有運氣:/
感謝
編輯
這裏的郵件調試日誌:
DEBUG: Recv: 220-cloud536.unlimitedwebhosting.co.uk ESMTP Exim 4.89 #1 Fri, 25 Aug 2017 23:52:55 +0100
DEBUG: Recv: 220-We do not authorize the use of this system to transport unsolicited,
DEBUG: Recv: 220 and/or bulk e-mail.
DEBUG: Send: EHLO localhost
DEBUG: Recv: 250-cloud536.unlimitedwebhosting.co.uk Hello localhost [149.255.60.167]
DEBUG: Recv: 250-SIZE 52428800
DEBUG: Recv: 250-8BITMIME
DEBUG: Recv: 250-PIPELINING
DEBUG: Recv: 250-AUTH PLAIN LOGIN
DEBUG: Recv: 250 HELP
DEBUG: Send: AUTH LOGIN
DEBUG: Recv: 334 VXNlcm5hbWU6
DEBUG: Send: bWVzc2VuZ2VyQGdhbWVyZmluZGVyLm5ldA==
DEBUG: Recv: 334 UGFzc3dvcmQ6
DEBUG: Send: ***************
DEBUG: Recv: 235 Authentication succeeded
DEBUG: Send: MAIL FROM:
<[email protected]>
DEBUG: Recv: 250 OK
DEBUG: Send: RCPT TO:
<[email protected]>
DEBUG: Recv: 250 Accepted
DEBUG: Send: DATA
DEBUG: Recv: 354 Enter message, ending with "." on a line by itself
DEBUG: Send: From: [email protected]
To: ***********@gmail.com
Subject: New Message from jamiemac262
DEBUG: Send: You have recieved a new message from jamiemac262<br>
Message:<br>
jamiemac262 has accepted your request to play Elite Dangerous
DEBUG: Send:
.
DEBUG: Recv: 250 OK id=1dlNTD-0006DI-TS
DEBUG: Send: QUIT
DEBUG: Recv: 221 cloud536.unlimitedwebhosting.co.uk closing connection
請儘快重置您的密碼。此外,您是否檢查過垃圾郵件文件夾,或者在gamerfinder收件箱中是否有任何'未發送的郵件返回發件人'電子郵件? Gmail可能會很挑剔。 –
我的密碼沒有在那裏列出?...或者我是否跳過那一行? (我這樣做有時哈哈) –
它被列爲base64編碼.. –