CodeIgniter Forums
Problem with sending SMTP mail in codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem with sending SMTP mail in codeigniter (/showthread.php?tid=40985)



Problem with sending SMTP mail in codeigniter - El Forum - 04-25-2011

[eluser]mattesticels[/eluser]
Hello all, this is the first time I have posted here Smile

been using codeigniter for little project of mine and absolutely love it, however I can not solve this problem I have with the email class, specifically smtp and googles email servers I think?

I know that this problem has occurred before as I checked on these forums before posting but it did not help me. The error i recieve is
Quote:An Error Was Encountered
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

From: "Matthew"
Return-Path:
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
=?utf-8?Q?Email_Test?=
<h1>Testing the email class.<h1>

Here is the function to send the email

Code:
function email_password() {
        $user_email = $this->input->post('email_address');
        
         $query = $this->db->get_where('account', array('email_address' => $user_email));
         if($query) {
             $config['protocol'] = 'smtp';
            $config['mail_path'] = 'ssl://smtp.googlemail.com';
             $config['smtp_host'] = 'ssl://smtp.googlemail.com';
             $config['smtp_port'] = 465;
             $config['smtp_user'] = '[email protected]';
             $config['smtp_pass'] = 'PASSWORD';
             $config['charset'] = "utf-8";
            $config['mailtype'] = "html";
            //$config['newline'] = "\r\n";
            
             //$this->email->initialize($config);
            $this->load->library("email", $config);
            
            $this->email->set_newline("\r\n");
             $this->email->from('[email protected]', 'Matthew');
            $this->email->to($user_email);
            
            $this->email->subject('Email Test');
            $this->email->message('<h1>Testing the email class.<h1>');    
            
            if ( ! $this->email->send()) {
                show_error($this->email->print_debugger());
            }
            else {
                echo('DONE');        
            }
         }
}

I have added the
Code:
extension=php_openssl.dll
in php.ini also but it still didnt help as i still revieve the error.

Could you please help me with this much appreciation will be returned too you.


Problem with sending SMTP mail in codeigniter - El Forum - 04-25-2011

[eluser]InsiteFX[/eluser]
Code:
$this->load->library('email');
$this->email->initialize($config);

InsiteFX


Problem with sending SMTP mail in codeigniter - El Forum - 04-25-2011

[eluser]mattesticels[/eluser]
When i add that this error comes up

Quote:An Error Was Encountered

220 mx.google.com ESMTP p40sm7720606wfc.19

hello: 250-mx.google.com at your service, [205.186.176.26]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH
250-ENHANCEDSTATUSCODES
250 PIPELINING

from: 250 2.1.0 OK p40sm7720606wfc.19

to: 555 5.5.2 Syntax error. p40sm7720606wfc.19

The following SMTP error was encountered: 555 5.5.2 Syntax error. p40sm7720606wfc.19

data: 503 5.5.1 RCPT first. p40sm7720606wfc.19

The following SMTP error was encountered: 503 5.5.1 RCPT first. p40sm7720606wfc.19
502 5.5.1 Unrecognized command. p40sm7720606wfc.19
The following SMTP error was encountered: 502 5.5.1 Unrecognized command. p40sm7720606wfc.19
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

User-Agent: CodeIgniter
Date: Mon, 25 Apr 2011 05:22:49 -0700
From: "Matthew"
Return-Path:
Subject: =?utf-8?Q?Email_Test?=
Reply-To: "[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_4db56799dd1b3"

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

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

Testing the email class.


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

<h1>Testing the email class.<h1>

--B_ALT_4db56799dd1b3--



Problem with sending SMTP mail in codeigniter - El Forum - 04-25-2011

[eluser]InsiteFX[/eluser]
From what I see you are sending and receiving from the same account!

Most email servers will not allow that.

InsiteFX


Problem with sending SMTP mail in codeigniter - El Forum - 04-25-2011

[eluser]mattesticels[/eluser]
changed to a different email address now I get this error

Quote:An Error Was Encountered
220 mx.google.com ESMTP w14sm6892547wfh.8

hello: 250-mx.google.com at your service, [205.186.176.13]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH
250-ENHANCEDSTATUSCODES
250 PIPELINING
from: 250 2.1.0 OK w14sm6892547wfh.8
to: 555 5.5.2 Syntax error. w14sm6892547wfh.8
The following SMTP error was encountered: 555 5.5.2 Syntax error. w14sm6892547wfh.8
data: 503 5.5.1 RCPT first. w14sm6892547wfh.8
The following SMTP error was encountered: 503 5.5.1 RCPT first. w14sm6892547wfh.8
502 5.5.1 Unrecognized command. w14sm6892547wfh.8
The following SMTP error was encountered: 502 5.5.1 Unrecognized command. w14sm6892547wfh.8
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Mon, 25 Apr 2011 05:50:15 -0700
From: "Matthew"
Return-Path:
Subject: =?utf-8?Q?Email_Test?=
Reply-To: "[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_4db56e07dbbe5"

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

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

Testing the email class.


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

<h1>Testing the email class.<h1>

--B_ALT_4db56e07dbbe5--



Problem with sending SMTP mail in codeigniter - El Forum - 04-25-2011

[eluser]InsiteFX[/eluser]
Try removing this:
Code:
// $config['mail_path'] = 'ssl://smtp.googlemail.com';

Try setting a timeout higher:
Code:
$config['smtp_timeout'] = 5;

Try this also, in php.ini:
Code:
[mail function]
; For Win32 only.
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
SMTP = localhost
smtp_port = 25

InsiteFX


Problem with sending SMTP mail in codeigniter - El Forum - 04-25-2011

[eluser]mattesticels[/eluser]
So worked out that the actual send to address was not being filled in which was causing all the problems. Thank you InsiteFX for helping me though.


Problem with sending SMTP mail in codeigniter - El Forum - 01-07-2014

[eluser]missiria[/eluser]
I put and test with this configuration code but is not work this is the error for me :

Code:
An Error Was Encountered

220-vmi19546 ESMTP Exim 4.82 #2 Wed, 08 Jan 2014 06:47:26 +0100 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.

hello: 250-vmi19546 Hello mydomain.com [ADDRESS IP]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250 HELP
Failed to authenticate password. Error: 535 Incorrect authentication data
from: 250 OK
to: 550-Please turn on SMTP Authentication in your mail client.  (iliago.com)
550-[ADDRESS IP]:59777 is not permitted to relay through this server
550 without authentication.
The following SMTP error was encountered: 550-Please turn on SMTP Authentication in your mail client. (mydomain.com) 550-[ADDRESS IP]:59777 is not permitted to relay through this server 550 without authentication.
data: 503-All RCPT commands were rejected with this error:
503-Please turn on SMTP Authentication in your mail client.  (mydomain.com)
503-[ADDRESS IP]:59777 is not permitted to relay through this server
503-without authentication.
503 Valid RCPT command must precede DATA
The following SMTP error was encountered: 503-All RCPT commands were rejected with this error: 503-Please turn on SMTP Authentication in your mail client. (mydomain.com) 503-[ADDRESS IP]:59777 is not permitted to relay through this server 503-without authentication. 503 Valid RCPT command must precede DATA
500 unrecognized command
The following SMTP error was encountered: 500 unrecognized command
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Wed, 8 Jan 2014 05:47:26 +0000
From: "Mailfrom" <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Subject: =?utf-8?Q?Email_Test_from_codeigniter?=
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_52cce66e56649"

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

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

Testing the email class.


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

<h1>Testing the email class.<h1>

--B_ALT_52cce66e56649--



Problem with sending SMTP mail in codeigniter - El Forum - 01-08-2014

[eluser]InsiteFX[/eluser]
Read the error message on the second line.



Problem with sending SMTP mail in codeigniter - El Forum - 01-08-2014

[eluser]missiria[/eluser]
Yeaaaaaah it's Exim4 I installed it and configure with my server Thanks man (y)