Preetham Hegde
Preetham Hegde

Reputation: 849

Codeigniter Sendmail() mail received after 5 minutes

I use sendmail method to send mail to the registered user. Email sends when user registered but it takes 5 minutes to send the mail every time.Here is my code.

Its in codeigniter framework.

public function MailTest()
{
    $this->load->helper(array('form', 'url'));
    $this->load->library('form_validation');
    $this->load->library('email');

    $config['protocol'] = 'sendmail';
    $config['mailpath'] = '/usr/sbin/sendmail';
    $config['charset'] = 'utf-8';
    $config['mailtype'] = 'html';
    $config['wordwrap'] = TRUE;
    $this->email->initialize($config);
    $this->email->from('[email protected]', 'preetham');
    $this->email->to('[email protected]');

    $this->email->subject(' Success! Your order has been sent.');


    $this->email->message('Success! Your order has been sent');
$this->email->send();
 //echo $this->email->print_debugger(); 
//echo "Success";
}

I ask some of my friends they suggested me that its not the programming issue its the Server issue.i just contacted godaddy but i did't get the satisfactory result. Please help me out if you know the solution.

Upvotes: 1

Views: 613

Answers (1)

Hardik Patil
Hardik Patil

Reputation: 97

Try using normal php mail() function to check if its server issue

<?php
$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>

if mail get sent fast then server is working fine. check codeigniter framework.

Upvotes: 1

Related Questions