2013-11-12 2 views
2

Я пытаюсь отправить электронное письмо в codeigniter, но что-то не так, и я не знаю, как это исправить. Успех при отправке в localhost, но когда я загружаю свое приложение в хост, он не может отправить. Это мой кодНе удается отправить письмо от gmail в codeigniter, ошибка аутентификации SMTP

 $this->load->library('email'); 
     $config['protocol'] = 'smtp'; 
     $config['smtp_host'] = 'ssl://smtp.gmail.com'; 
     $config['smtp_port'] = '465'; 
     $config['smtp_timeout'] = '7'; 
     $config['smtp_user'] = 'username'; 
     $config['smtp_pass'] = '****'; 
     $config['charset'] = 'utf-8'; 
     $config['newline'] = "\r\n"; 
     $config['mailtype'] = 'html'; // or html 
     $config['validation'] = TRUE; // bool whether to validate email or not 
     $this->email->initialize($config); 

     $this->email->send(); 

     echo $this->email->print_debugger(); 

И это моя ошибка, когда я отправить уведомления по электронной почте

Failed to authenticate password. Error: 535 Incorrect authentication data 

*from: 250 OK 
to: 550-Please turn on SMTP Authentication in your mail client, or login to the 
550-IMAP/POP3 server before sending your message. mb2d247.vdrs.net 
550-(hanghieunara.com) [112.78.2.247]:51939 is not permitted to relay through 
550 this server without authentication.* 

The following SMTP error was encountered: 550-Please turn on SMTP Authentication in your mail client, or login to the 550-IMAP/POP3 server before sending your message. 

mb2d247.vdrs.net 550-(hanghieunara.com) [112.78.2.247]:51939 is not permitted to relay through 550 this server without authentication. 
+0

возможно дубликат http://stackoverflow.com/a/10588040/1239506? –

+0

Нет, это так, я так думаю – webkitvn

ответ

0

Смотрите, если учетная запись электронной почты не активна с безопасностью difinições для внешнего доступа, если требуется предоставить доступ к SMTP-сервер вашего сайта (ваш адрес электронной почты), чтобы вы могли выполнять аутентификацию.

0

Чтобы отправить Smtp Gmail autenticated с CodeIgniter

1 - Убедитесь, что если OpenSSL в вашем PHP инсталяция включена.

2- Эта команда имеет фундаментальное значение для работы скриптов: $ this-> email-> set_newline ("\ r \ n");

$ конфиг = Array (

'protocol' => 'smtp', 
'smtp_host' => 'ssl://smtp.googlemail.com', 
'smtp_port' => 465, 
'smtp_user' => '[email protected]', 
'smtp_pass' => 'your_password', 

);

$ this-> load-> library ('email', $ config);

$ this-> email-> set_newline ("\ r \ n");

$ this-> email-> from ('[email protected] ',' Ваше имя ');

$ this-> email-> to ([email protected] ');

$ this-> email-> subject ('CodeIgniter Rocks Socks');

$ this-> email-> message ('Hello World');

если (! $ This-> email-> отправить())

show_error($this->email->print_debugger()); 

еще

echo 'Your e-mail has been sent!'; 

Полная ссылка Решение: https://ellislab.com/forums/viewthread/84689/

Смежные вопросы