2017-03-01 7 views
0

電子メールはローカルで正常に送信されます。しかし、この問題はプロダクションサーバで発生します。これは未知のgmail設定です。問題であり、どのように私はこの問題を解決することができますどのようなCakePHP 3 cPanelサーバの不明な電子メール設定 "gmail"

'gmail' => [ 

     'className' => 'Smtp', 

     // The following keys are used in SMTP transports 

     'host' => 'ssl://smtp.gmail.com', 

     'port' => 465, 

     'timeout' => 60, 

     'username' => '[email protected]', 

     'password' => 'xxxxxxxxxxxxxxxxxxxxx', 

     'client' => null, 

     'tls' => true, 

    ] 

私の電子メールの設定は次のようになりますか?

+1

サーバーに適切なapp.phpファイルをアップロードしていない可能性があります – tarikul05

答えて

-1

あなたは、本番サーバー上で確認app.phpファイルをお使いのコントローラに

///////////////////// Configuration ///////////////////////// 

$host  = 'ssl://smtp.gmail.com'; 
$username = '[email protected]'; 
$password = 'xxxxxxx'; 
$port  = '465'; 
$email_to = '[email protected]'; 
$senderName = 'abc'; 
$email_id_reply ='[email protected]'; 

$new_attachments = '<some image>'; 
$msgsend ='Hello!!'; 

Email::configTransport('WebMail'.$recipient, 
         [ 
         'className' => 'Smtp', 
         'host' => $host, 
         'port' => $port, 
         'timeout' => 30, 
         'username' => $username, 
         'password' => $password, 
         'client' => null, 
         'tls' => null 
         ] 
        ); 

////////// SEND MAIL 

$transport = ['transport' => 'WebMail'.$recipient]; 

$email = new Email($transport); 

$email ->template('default','default') 
     ->emailFormat('both') 
     ->from([$username => $senderName]) 
     ->to($email_to) 
     ->replyTo($email_id_reply) 
     ->subject('Client Message'); 

$email->attachments($new_attachments); 

$response = $email->send($msgsend); 
0

をこれらを使用することができ、必要な設定が含まれています。 app.phpはデフォルトでgitによって無視されるため、期待通りにあなたのケースに展開されない可能性があります。

関連する問題