2016-07-29 163 views
0

我有一臺使用Debian的Kimsufi(OVH)服務器。使用PHPMailer通過Kimsufi服務器發送SMTP郵件

我想使用PHPMailer library發送SMTP電子郵件。

我不知道用戶名和密碼應該是什麼。

$this->mail->isSMTP();    // Set mailer to use SMTP 
    $this->mail->CharSet = 'UTF-8'; 
    $this->mail->Host = 'my server ip'; // Specify main and backup SMTP servers 
    $this->mail->SMTPAuth = true;  // Enable SMTP authentication 
    $this->mail->Username = '';   // SMTP username 
    $this->mail->Password = '';   // SMTP password 
    $this->mail->SMTPSecure = '';  // Enable TLS encryption, `ssl` also accepted 
    $this->mail->Port = 25;    // TCP port to connect to 

如何獲取所需的用戶名和密碼?

回答

0

用戶名和密碼將是發件人的電子郵件詳細信息。它會詢問你想通過哪個郵件地址通過phpmailer發送郵件。由於phpmailer庫需要使用SMTP用戶名&密碼來發送郵件並確認收件箱傳送。不僅如此,它還需要SMTP服務器&認證詳情。

讓我們使用個人Gmail帳戶通過的PHPMailer發送郵件在這種情況下,你的代碼會是這樣

$this->mail->isSMTP();    // Set mailer to use SMTP 
$this->mail->CharSet = 'UTF-8'; 
$this->mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers 
$this->mail->SMTPAuth = true;  // Enable SMTP authentication 
$this->mail->Username = '[email protected]';   // SMTP username 
$this->mail->Password = 'yourgmailpassword';   // SMTP password 
$this->mail->SMTPSecure = 'tls';  // Enable TLS encryption, `ssl` also accepted 
$this->mail->Port = 587;    // TCP port to connect to 
+0

感謝@Sachin,但我不希望使用個人電子郵件帳戶發送電子郵件。我想用我的專用服務器。這是問題所在。 – Macbernie

+0

如果您想要在您的域名中使用電子郵件地址,請在該域名下創建一個電子郵件地址,並設置用戶名和密碼,而不是谷歌地址。或者讓我知道域名會給你所有的信息使用 –

相關問題