2016-04-11 9 views
0

私はCodeigniter 3.0を使用してメールを送信しようとしています。電子メールクラス:Codeigniter 3.0、Cant Send Email

マイコントローラー:?

function index() 
    { 

       $ci = get_instance(); 
       $ci->load->library('email'); 
       $config['protocol'] = "smtp"; 
       $config['smtp_host'] = "ssl://smtp.gmail.com"; 
       $config['smtp_port'] = "465"; 
       $config['smtp_user'] = "[email protected]"; 
       $config['smtp_pass'] = ""; 
       $config['charset'] = "utf-8"; 
       $config['mailtype'] = "html"; 
       $config['newline'] = "\r\n"; 

       $ci->email->initialize($config); 
       $ci->email->from('[email protected]', 'Blabla'); 
       $list = array('[email protected]'); 
       $ci->email->to($list); 
       $this->email->reply_to('[email protected]', 'Explendid Videos'); 
       $ci->email->subject('This is an email test'); 
       $ci->email->message('It is working. Great!'); 
       $result=$ci->email->send(); 

       if($result){ 
        $data['email']="sent"; 
       } 
       else{ 
        $data['email']="not Sent"; 
       } 
     //echo $this->email->print_debugger(); 
     $this->load->view('welcome_message',$data); 

私の見解

<?php 
if ($email="not Sent"){ 
    echo $this->email->print_debugger(); 
} 
else{ 
    echo "Sent"; 
} 

>

これ以外

、私はあまりアプリはGmailにログインできるようにするためにGmailアカウントを設定しました。

まだ私はこのエラーを取得:

220 smtp.gmail.com ESMTP p10sm8628622obk.11 - gsmtp hello: 250-smtp.gmail.com at your service, [23.102.172.97] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 Failed to authenticate password. Error: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 p10sm8628622obk.11 - gsmtp Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. User-Agent: CodeIgniter Date: Mon, 11 Apr 2016 13:17:26 -0700 From: "Blabla" Return-Path: To: [email protected] Reply-To: "Explendid Videos" Subject: =?utf-8?Q?=54=68=69=73=20=69=73=20=61=6E=20=65=6D=61=69=6C=20=74=65=73=74?= X-Sender: [email protected] X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <[email protected]> Mime-Version: 1.0

Content-Type: multipart/alternative; boundary="B_ALT_570c06564edf2"

This is a multi-part message in MIME format. Your email application may not support this format.

--B_ALT_570c06564edf2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit

It is working. Great!

--B_ALT_570c06564edf2 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

It is working. Great=21

--B_ALT_570c06564edf2--

が、これはホスティングサービスではなく、ローカルホストであるしようとしています。

私は手がかりがありません。パスワードフィールドにプレーンテキストを使用しています。それは正しいですか、私は何かを生成すべきですか?

助けてください。

+3

変更smtp_host。ここで参照してくださいhttp://stackoverflow.com/questions/1555145/sending-email-with-gmail-smtp-with-codeigniter-email-library – carlosdubusm

+0

私はすべてを試して、働いていない、それは同じエラーを言う。 – Sam

答えて

0

変更] SSL://smtp.googlemail.com」にこれらの

$config['smtp_host'] = "ssl://smtp.googlemail.com"; # Change 
$config['smtp_port'] = "465"; 
$config['smtp_user'] = "[email protected]"; 
$config['smtp_pass'] = ""; # Your account password 
+0

はまったく動作しません。 – Sam

関連する問題