CodeIgniter Forums
I am new and in problem - mail library - sending emails using SMTP - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: I am new and in problem - mail library - sending emails using SMTP (/thread-20115.html)

Pages: 1 2


I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]verynewtothis[/eluser]
Trying to send email using protocol = SMTP on windows. Have provided the user id, password and SMTP server address as well..
I get an error
Quote:Fatal error: Maximum execution time of 90 seconds exceeded in E:\inetpub\vhosts\xyz.com\httpdocs\cxvx\libraries\Email.php on line 1812
Any guesses?

Also, Do I need to set SMTP settings in PHP.ini to send SMTP emails using CI's mail library's SMTP?


I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]Evil Wizard[/eluser]
Yes and you'll probably want a smtp server too


I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]verynewtothis[/eluser]
I don't have access to php.ini file so I did this in the constructor:
Code:
function __construct()
    {
        ini_set("SMTP","mail.fgdf.com");
        ini_set("smtp_port",25);
        parent::Controller();    
        //More Stuff
    }

Same error..


I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]TheFuzzy0ne[/eluser]
How many Emails are you attempting to send at any one time?


I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]verynewtothis[/eluser]
two seperate emails.


I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]TheFuzzy0ne[/eluser]
Are you able to send mail using the Web interface provided by your Web host?


I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]verynewtothis[/eluser]
Yes I can


I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]TheFuzzy0ne[/eluser]
Please post your controller code, and the config settings you're using for the Email library. I use SMTP, and I've not needed to change anything in the php.ini - It's all configured via CodeIgniter.


I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]verynewtothis[/eluser]
Controller
Code:
class Contact extends Controller {

    function __construct()
    {
        //ini_set("SMTP","mail.theServer.com");
        //ini_set("smtp_port",25);
        parent::Controller();    
        $this->load->library('form_validation');
    }
    
    
    function complaints_and_suggestions()
    {
        
            //Create Email - Other Code not shown here
            
            $message = "Following has been received:\n\n";
            $message .= "First Name   : ".$this->input->post('fname')."\n";
            $message .= "Last Name    : ".$this->input->post('lname')."\n";
            $message .= "Email        : ".$this->input->post('email')."\n";
            $message .= "Contact No.  : ".$this->input->post('contact')."\n";
            
            $this->load->library('email');                
            //Send Email to Staff    
            $this->email->from('[email protected]', 'Administrator');
            $this->email->to('[email protected]');                
            $this->email->subject("Some Subject");
            $this->email->message($message);
            
            $this->email->send();
            
            $this->email->clear();
            
            //Send Email to Visitor
            $message = "Respected site visitor.\n\n";
            $message .= "Thank you for submitting your comments\n";
            
            $this->email->from('[email protected]', 'Site Administrator');
            $this->email->to($this->input->post('email'));                
            $this->email->subject("Your Comments");
            $this->email->message($message);
            $this->email->send();
            $this->email->print_debugger();
            
            redirect('contact/success', 'location');
        endif;
    }
}

Email Configuration - from file email.php residing in config directory

Code:
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'mail.theServer.com';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'pass';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;



I am new and in problem - mail library - sending emails using SMTP - El Forum - 06-29-2009

[eluser]TheFuzzy0ne[/eluser]
I'd suggest that you comment out all of the code in your method, and uncomment it line by line, until you find where the problem is. If that fails, then I'd suggest you try sending the Email with sendmail, and seeing if that makes any difference.