Welcome Guest, Not a member yet? Register   Sign In
Adding Specific Configuration in CodeIgniter Email Class
#1
Question 

I'm trying to send an email in my localhost and i use codeigniter's email class function but i always encountered SSL Handshake error,so now i try PHP mailer , so now i cannot still sent email from my local computer , then i found out that in PHPmailer settings, i should add this configuration :

PHP Code:
$mail->SMTPOptions  array(
 
  'ssl' => array(
 
    'verify_peer' => false,
 
    'verify_peer_name' => false,
 
    'allow_self_signed' => true
    
)
 ); 

Now i can send email from my computer, but i would prefer to use codeigniter's email library because i dont want additional class or scripts to download

So my question , how do i add that configuration to codeigniter's email class ?

PHP Code:
array(
 
  'ssl' => array(
 
    'verify_peer' => false,
 
    'verify_peer_name' => false,
 
    'allow_self_signed' => true
    
)
 ); 
Neko CMS - A free Simple CMS! developed using CodeIgniter
Novi
Software Developer / Web Developer
Reply
#2

I don't remember whether the original CodeIgniter's email library can do this, but it can be upgraded to use PHPMailer. You may try this project of mine https://github.com/ivantcholakov/codeigniter-phpmailer , the README contains instructions about the installation.

Your application code about emails would not need modifications, leave it as it is.

Then, see the answer of this question: https://github.com/ivantcholakov/codeign.../issues/14
A new configuration option has been added that is interesting for you, $config['smtp_conn_options'] .
Reply
#3

On localhost you need to setup the SMTP etc; in your php.ini file.

I setup my localhost to use my comcast smtp server and it works fine.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

(12-17-2017, 05:09 AM)InsiteFX Wrote: On localhost you need to setup the SMTP etc; in your php.ini file.

I setup my localhost to use my comcast smtp server and it works fine.

So, was I right? It was a problem with the firewall and the ports?

I get solve this problem :

Edit File System/libraries/Email.php 

function [font=Consolas,]_smtp_connect
[/font]
change [font=Consolas,]fsockopen to [font=Tahoma, Verdana, Arial, sans-serif]stream_socket_client[/font][/font]
[font=Consolas,]$context = stream_context_create([
            'ssl' => [
                'verify_peer' => false,
                'verify_peer_name' => false
            ]
        ]);



$this->_smtp_connect = stream_socket_client($ssl.$this->smtp_host . ':' 
                                        . $this->smtp_port,
                                        $errno,
                                        $errstr,
                                        $this->smtp_timeout,STREAM_CLIENT_CONNECT, $context);
[/font]
Reply




Theme © iAndrew 2016 - Forum software by © MyBB