email library |
email function does not work,
$this->load->library('email'); $this->email->from('[email protected]', 'Admin'); $this->email->to('[email protected]'); $this->email->subject('Email Test'); $this->email->message('Testing the email class.'); if($this->email->send()){ echo 'Email enviado'; } else{ show_error($this->email->print_debugger()); } the error is " An Error Was Encountered Unable to send email using PHP mail(). Your server might not be configured to send mail using this method. " what do i have to configure? thanks
Hi isideas.
Have you a shared server? Typically shared servers do not allow you to use the mail function. You can contact with Customer Service of your Hosting. With your method the email will go directly to SPAM. You must use SMTP You can do this before contact with the Customer Service: Code: $this->load->library('email');
Hi, I used your code, I changed the password...
I am using DigitalOcean Droplet with Lamp 14.04 as server Do I have to do another configuration in php.ini or other file? /*this is the error message*/ An Error Was Encountered 220 smtp.gmail.com ESMTP 65sm8618367qkq.41 - gsmtp hello: 250-smtp.gmail.com at your service, [45.55.196.47] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN 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 65sm8618367qkq.41 - gsmtp from: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14257 65sm8618367qkq.41 - gsmtp The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14257 65sm8618367qkq.41 - gsmtp to: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14257 65sm8618367qkq.41 - gsmtp The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14257 65sm8618367qkq.41 - gsmtp data: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14257 65sm8618367qkq.41 - gsmtp The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14257 65sm8618367qkq.41 - gsmtp 502 5.5.1 Unrecognized command. 65sm8618367qkq.41 - gsmtp The following SMTP error was encountered: 502 5.5.1 Unrecognized command. 65sm8618367qkq.41 - 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, 31 Aug 2015 07:33:35 -0400 From: "Admin" <[email protected]> Return-Path: <[email protected]> To: [email protected] Subject: =?utf-8?Q?Email_Test?= Reply-To: "[email protected]" <[email protected]> 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_55e43b8fcf60c" This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_55e43b8fcf60c Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Testing the email class. --B_ALT_55e43b8fcf60c Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Testing the email class. --B_ALT_55e43b8fcf60c--
Assuming you are sure in gmail 2factor auth is disabled, weak apps enabled etc. there could be an other problem. Test send an email via telnet / openssl s_client.
I found that "AUTH LOGIN" (codeiginter default) does not work, but AUTH PLAIN does. (Strange since ehlo command states AUTH LOGIN support). Therefore I decided to add PLAIN auth to codiginter and AUTH LOGIN as fallback. I did extend the Email library (via MY_Email class) to overwrite the login function: PHP Code: protected function _smtp_authenticate() The Codeiginter smtp protocol implementation is very basic. What I did is more like a quick fix than a perfect solution. But it worked. PHP Code: $config = array ( Using single quotes for newline didn't work, therefore my email config (with blank fields filled by my login data). Hope this helps.
Also some servers do not allow sending and receiving emails from the same email address.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |