0

I know this is repeated question but i have tried all of Stackoverflow solutions and other googled links. But got no solution.

My Code:

$this->load->library('email');

// $config['protocol']      = 'smtp';
// $config['smtp_host']     = 'ssl://smtp.gmail.com';
// $config['smtp_port']     = 465;
// $config['smtp_timeout']  = '7';
// $config['smtp_user']     = 'myemail@gmail.com';
// $config['smtp_pass']     = '*********';
$config['protocol']     = 'mail'; // mail, sendmail, or smtp
// $config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'utf-8'; // utf-8, iso-8859-1, etc
$config['newline']      = "\r\n"; // “\r\n” or “\n” or “\r”
$config['mailtype']     = 'html'; // text or html
$config['validation']   = TRUE; // TRUE or FALSE whether to validate email or not      

$this->email->initialize($config);

$this->email->from('AutoMailer@MyWEb.com');
$this->email->to($email);
$this->email->subject($_POST['subject']);
$this->email->message($message);
$result = $this->email->send();
if ($result) {
     $this->session->set_flashdata('message', 'Email Send Successfully!');
} else {
     echo $this->email->print_debugger();exit;
}

$email is some valid email and $message is html message I want to use simple 'mail' protocol to send email. Mail Send successfully but in My email Inbox/Spam no email to found. This was good till 2.x version But from 3.x version i keeping having these problems. So, I tried used sendmail & smtp protocol solutions but that gives no help. Please anyone have good solution for this or any debugging tips.

Robin Rai
  • 392
  • 3
  • 14
  • This is a common issue with PHP and sending emails. Simply put all any of the protocols you use will return the successfulness of queuing of a message to be sent by the server. See the answer I flagged as duplicate for debugging tips. – Will B. Dec 31 '17 at 06:57
  • Thanks for the link @fyrye I tried to figure out problem from tips. Codeigniter have pretty good email libraries so some kind of mail headers or recipient value problems should not occured. About web server support and configuration, Wordpress is sending email successfully in inbox from same server. And yeah, i tried PHPMailer before to get proper solutions. But no help. – Robin Rai Dec 31 '17 at 07:09
  • Use tcpdump to check if the problem in your application or in SMTP server. – 4EACH Dec 31 '17 at 07:53
  • what is output of print_debugger? – siddhesh Dec 31 '17 at 14:03
  • print it in if clause rather than else one. – siddhesh Dec 31 '17 at 14:04

0 Answers0