谢谢页面表格后没有显示

时间:2017-07-11 07:24:34

标签: php email send

如何通过send_mail.php发送此邮件后,将该页面直接转到另一个名为tack.php的感谢页面,该页面位于结构中与此mail.inc.php文件相同的位置?< / p>

<?php header("Content-Type: text/html; charset=utf8");
function mail_file($to, $from, $subject, $body, $file) {
    $boundary = md5(rand());
    $headers = array(
        'MIME-Version: 1.0',
        "Content-Type: multipart/mixed; charset=UTF-8; boundary=\"{$boundary}\"",
        "Content-Transfer-Encoding: 8bit", //Nytt 170711
        "From: {$from}"
    );
    $message = array(
        "--{$boundary}",
        //'Content-Type: text/HTML; charset=iso-8859-1', 170707
        'Content-Transfer-Encoding: quoted-printable', 
        '', 
        quoted_printable_encode($body), // Här är nya innehåll kodat som quoted-printable istället. 
        '',                             // Kommer orsaka en extra radbrytning efter meddelandet.
        "--{$boundary}",
        "Content-Type: {$file['type']}; name=\"{$file['name']}\"",
        "Content-Disposition: attachment; filename=\"{$file['name']}\"",
        "Content-Transfer-Encoding: base64", 
        '',
        chunk_split(base64_encode(file_get_contents($file['tmp_name']))),
        "--{$boundary}--",
        '',
    );
    mail($to, $subject, implode("\r\n", $message), implode("\r\n", $headers));
}
?>

1 个答案:

答案 0 :(得分:3)

在代码末尾添加标题:

header('Location: http://www.example.com/thank_you.php');

它会将用户重定向到指定的页面

编辑:

同时删除您的第一个标题:

php header ("Content-Type: text/html; charset=utf8");

你不需要它,因为你不应该返回任何东西