代码之家  ›  专栏  ›  技术社区  ›  Chuck Burgess

生成电子邮件到文件而不发送

  •  0
  • Chuck Burgess  · 技术社区  · 15 年前

    我想使用 mail() 功能:

    <?php
    $to      = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" .
        'Reply-To: webmaster@example.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    // instead of sending mail, out put to file
    mail($to, $subject, $message, $headers);
    ?>
    

    但我不希望它真的发送电子邮件,而是希望它将电子邮件输出到包含所有邮件头等的文件中,就像邮件服务器看到的那样。

    2 回复  |  直到 12 年前
        1
  •  0
  •   allnightgrocery    15 年前

    我们使用 Zend_Mail 库和具有不同的目标传输(SMTP、stdout、文件等)。为了以防万一,这是Zend-mail的一些信息 transports .

        2
  •  1
  •   Vladislav Rastrusny    15 年前

    使用Swiftmailer,您可以使用插件: http://swiftmailer.org/wikidocs/v3/plugindev/sendevent