邮件返回假 [英] Mail returns false

查看:78
本文介绍了邮件返回假的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用自定义库.直到刚刚结束,图书馆才运转良好.从今天开始,它显然返回false.

I'm currently using a custom made library at my job. Until just rencently the library was working perfectly. It apparently return false since about today.

该库本身基本上是函数邮件的包装器.它构建了边界"部分以及所有内容.

The library itself it basically a wrapper around the function mail. It builds the "boundaries" parts and everything.

由于该类足够大,所以我不会在这里发布它……但是我想知道,为什么邮件会返回false的理论原因是什么?

Since the class is quite big enough I wont post it here ... but I'm wondering, what are the reasons in theory of why mail would return false?

  • 在PHP.ini中设置了SMTP
  • 发件人设置在标题中
  • 发件人为int形式:>
  • 一切都正确发送(body + headers + subject)
  • 假设mail()在网站上可以正常工作,但在此特定页面上却不能正常工作.我知道这一定是我要来的,但是有个可以开始寻找的地方会很有趣.
  • 哦,是的,该库没有记录.

刚刚发现了一个较小的功能,但仍然无法正常工作,我将其打印出来:

[edit] Just found a smaller function and still doesn't work, I'll print it out then:

function send_html($from, $email, $subject = "AUCUN", $message, $cc = "", $bcc ="", $priotity = "3") {
    $headers = "";
    $headers .= "MIME-Version: 1.0\r\n"; 
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    if (strpos($from, "ourwebsite.com") != false || strpos($from, "rencontresportive.com") != "") {
        $headers .= "From: Ourwebsite.com <" . $from . ">\r\n";
    } else {
        $headers .= "From: " . $from . " <" . $from . ">\r\n";
    }

    $headers .= "X-Sender: <" . $from . ">\r\n";
    $headers .= "X-Priority: " . $priotity . "\r\n";
    $headers .= "X-Mailer: PHP\r\n";
    $headers .= "Return-Path: <admin@ourwebsite.com>\r\n";

    if ($cc != "") {
        $headers .= "cc:" . $cc . "\r\n";
    }
    if ($bcc != "") {
        $headers .= "bcc:" . $bcc . "\r\n";
    }
        if (mail($email, $subject, $message, $headers)) {
        return true;
    } else {
        return false;
    }
}

我用:

send_html(contact@ourwebsite.com, me@me.com, utf8_decode("the subject"), "<h1>test</h1>");

推荐答案

如果该类只是函数邮件的包装,我将尝试将调用邮件函数时使用的参数打印到文件中

If the class is only a wrapper around the function mail, I would try printing to a file the parameters used when calling the mail function

这篇关于邮件返回假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆