Welcome Guest, Not a member yet? Register   Sign In
I am new and in problem - mail library - sending emails using SMTP
#1

[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?
#2

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

[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..
#4

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

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

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

[eluser]verynewtothis[/eluser]
Yes I can
#8

[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.
#9

[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;
#10

[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.




Theme © iAndrew 2016 - Forum software by © MyBB