2016-05-31 6 views
-1

何かがありますか?私は高い、低い、検索し、私のコードで何が間違っているのか分からない。また、私は郵便ではなく公衆を使っているのですか?SMTP Gmailのエラーです。私は電子メールを受け取っていません

<?php 
require_once('phpmailer.php'); 
class Mail extends PhpMailer 
{ 
    // Set default variables for all new objects 
    public $mail  = IsSMTP; 
    public $From  = '[email protected]'; 
    public $FromName = SITETITLE; 
    public $Host  = 'smtp.gmail.com'; 
    public $port  = 587; 
    public $Mailer = 'smtp'; 
    public $SMTPAuth = true; 
    public $Username = '[email protected]'; 
    public $Password = 'password'; 
    public $SMTPSecure = 'tls'; 
    public $WordWrap = 75; 

    public function subject($subject) 
    { 
     $this->Subject = $subject; 
    } 

    public function body($body) 
    { 
     $this->Body = $body; 
    } 

    public function send() 
    { 
     $this->AltBody = strip_tags(stripslashes($this->Body))."\n\n"; 
     $this->AltBody = str_replace("&nbsp;", "\n\n", $this->AltBody); 
     return parent::send(); 
    } 
} 

これは現在のコードであり、問​​題は解決されていません。新しいアイデアは?

+0

、および465 – Jayy

+0

可能[PHPMailer SMTPエラー:サーバーへの接続に失敗しました]の複製(0120-325-331)。 – brimstone

+0

Gmailのサーバーをスパムの人にする – user2260040

答えて

0

おそらくポートです。

public $port  = '4587'; 

if you tried configuring your SMTP server on port 465 (with SSL/TLS) and port 587 (with STARTTLS), but are still having trouble sending mail, try configuring your SMTP to use port 25 (with SSL/TLS).

Apple Mail users: At times, Mail may misinterpret your SMTP server settings. If you currently have 'smtp.gmail.com:[email protected]' in the 'Outgoing Mail Server:' field of your settings, please try changing the field to 'smtp.gmail.com' and saving your settings.

https://support.google.com/mail/answer/78775?hl=en

あなたは465と587のポートを混合しました。

まだ動作しない場合は、接続のデバッグを試みることができます。たとえば、PHPMailer only sends email when SMTPDebug = trueを参照してください。

/** 
* SMTP class debug output mode. 
* Debug output level. 
* Options: 
* * `0` No output 
* * `1` Commands 
* * `2` Data and commands 
* * `3` As 2 plus connection status 
* * `4` Low-level data output 
* @var integer 
* @see SMTP::$do_debug 
*/ 
public $SMTPDebug = 0; 

問題があるかもしれないものを見つけるためにそれを使用してください:文書からも

、。それはどこで止まるか教えてくれます。

+0

修正済み、まだ何もありません – Jayy

+0

デバッグを確認してください - 返信を更新 – Grzegorz

0

ポートではなく、ここで4587.

のがデフォルトのGmailのSMTP設定されなければなりません。

  • GmailのSMTPサーバーアドレス:smtp.gmail.com
  • GmailのSMTPユーザー名:あなたの 完全なGmailアドレス(例えば[email protected]
  • GmailのSMTPパスワード:Gmailのパスワード
  • のGmail SMTPポート(TLS):587
  • GmailのSMTPポート(SSL):465
  • GmailのSMTP TLS/SSLが必要:はい

と次にライン

public $mail = 'IsSMTP()' 

を変更してくださいことができます:SMTPのために確保さ1に

+0

あなたはsmtp.mandrillapp.comにGmailの資格情報を送ることをお勧めしますか? – zerkms

+0

@zerkms私はホストについて誤解されました。 –

+0

編集して肯定的な結果を受け取っていません – Jayy

0

変更ポート:私は両方587試してみました465

関連する問題