提问人:Sabino Diaz 提问时间:5/6/2022 最后编辑:VickelSabino Diaz 更新时间:5/6/2022 访问量:118
CodeIgniter 3 电子邮件不会向其他电子邮件服务器发送电子邮件,而是向苹果发送电子邮件
CodeIgniter 3 email not sending emails to other email servers but apple
问:
出于某种原因,我只是收到苹果电子邮件的电子邮件,但 gmail、Microsoft 等。我正在使用带有SSL的自己的smtp服务器,我检查了SPF,没有问题。我还检查了标题等。
我也尝试使用 PHPMailer,但只使用 gmail smtp 发送。 任何解决此问题的帮助或指导将不胜感激!
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;
}
}
}
答: 暂无答案
评论
SMTPDebug = 2