Welcome Guest, Not a member yet? Register   Sign In
sending email using code igniter
#6

(This post was last modified: 01-16-2015, 09:20 AM by Rufnex. Edit Reason: Format code )

I updated the code with everyone's suggestions. Nothing seems any different. Do I need to create a view to "see" the result of the call to this controller? This is the URL to where this is hosted:
http://www.designtimedesignworks.com/ci/index.php/email .

PHP Code:
<?php

class Email extends CI_Controller
{
    function 
__construct()
    {
        
parent::__construct(); // was parent::Controller(); 
        
    
}
    
    function 
index()
    {
        
$config = array( //"Array" changed to "array" 1/15/15
        
            
'protocol' => 'smtp',
            
'smtp_host' => 'ssl://smtp.googlemail.com',
            
'smtp_port' => 465//465
            
'smtp_user' => '[email protected]',
            
'smtp_pass' => 'pass'
            'mailtype' 
=> 'text',
             
'charset' => 'iso-8859-1',
             
'wordwrap' => TRUE
        
);
        
        
$this->email->initialize($config); // added on 1/16
        
        
$this->load->library($config); //$config, 'email' removed
        
        
$this->email->set_newline("\r\n");
        
        
$this->email->from('[email protected]','Ben Abrams');
        
        
$this->email->to('[email protected]');
        
        
$this->email->subject('This is an email test.');
        
        
$this->email->message('It is working.');
        
        
$this->email->send(); // uncommented 1/16/15
        
        //echo $this->email->print_debugger();
        
        
if($this->email->send())
        {
            echo 
'Your email was sent';
        }
        else
        {
            
show_error($this->email->print_debugger());
        }
        
    }

Reply


Messages In This Thread
sending email using code igniter - by Ben - 01-15-2015, 08:35 PM
RE: sending email using code igniter - by Rufnex - 01-16-2015, 01:53 AM
RE: sending email using code igniter - by advoor - 01-16-2015, 03:30 AM
RE: sending email using code igniter - by Ben - 01-16-2015, 08:43 AM
RE: sending email using code igniter - by Rufnex - 01-16-2015, 09:23 AM
RE: sending email using code igniter - by Ben - 01-16-2015, 11:58 AM
RE: sending email using code igniter - by Rufnex - 01-16-2015, 03:08 PM
RE: sending email using code igniter - by Ben - 01-16-2015, 08:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB