For some reason I'm just getting emails to apple emails but gmail, Microsoft etc. I'm using my own smtp server with SSL, I checked SPF and there is no problems. I also checked headers and etc.
I also try using PHPMailer but only sends with gmail smtp. Any help or direction to fix this issue will be very appreciated!
function send_mail($to, $subject, $message) {
$CI = get_instance();
$email_library = get_email_library();
if($email_library == 'codeigniter'){
$email_config = Array();
$email_config["protocol"] = "smtp";
$email_config["charset"] = "utf-8";
$email_config["mailtype"] = "html";
$email_config["smtp_host"] = smtp_host();
$email_config["smtp_port"] = smtp_port();
$email_config["smtp_user"] = smtp_email();
$email_config["smtp_pass"] = smtp_password();
$email_config["smtp_crypto"] = smtp_encryption();
if($email_config["smtp_crypto"] == 'none'){
$email_config["smtp_crypto"] = "";
}
$CI->load->library('email', $email_config);
$CI->email->clear(true);
$CI->email->set_newline("\r\n");
$CI->email->set_crlf("\r\n");
$CI->email->from(from_email(), company_name());
$CI->email->to($to);
$CI->email->subject($subject);
$CI->email->message($message);
if($CI->email->send()){
return true;
}else{
return false;
}
}else{
require_once('vendor/phpmailer/class.phpmailer.php');
$CI = new PHPMailer();
$CI->IsSMTP();
$CI->SMTPDebug = 1;
$CI->SMTPAuth = true;
$CI->SMTPSecure = smtp_encryption();
$CI->Host = smtp_host();
$CI->Port = smtp_port();
$CI->IsHTML(true);
$CI->Username = smtp_email();
$CI->Password = smtp_password();
$CI->SetFrom(from_email());
$CI->Subject = $subject;
$CI->Body = $message;
$CI->AddAddress($to);
if($CI->Send()){
return true;
}else{
return false;
}
}
}