Q:PHP Mailer error using Go Daddy |
Q:PHP邮件错误使用Go Daddy |
mailPlease help. My PHP mailer is not working that I host on Go Daddy. Any idea why the email won't send?
<?php
session_start();
$contact=$_POST['contact'];
$phone=$_POST['telephone'];
$email=$_POST['email'];
$msg=$_POST['message'];
$to="webform@xxx.com";
$subject="Contact Form";
$from=$email;
$message .= '<table border="1px" width="50%" style="border:1px black solid;margin:0px auto">';
$message .= '<tr><th colspan="2" style="text-align:center">Contacts Information</th></tr>';
$message .= '<tr><td>Name :- </td><td>'.$contact.'</td></tr>';
$message .='<tr> <td>Phone No. :- </td><td>'.$phone.'</td></tr>';
$message .= "<tr><td>Email :- </td><td>" . $email . "</td></tr>";
$message .= "<tr><td>Message :- </td><td>" . $msg. "</td></tr>";
$message .= "</table>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
mail($to, $subject, $message, $headers);
header("Location: sent.html");
|
mailplease帮助。我的PHP邮件是不工作的,我的主机去爸爸。知道为什么电子邮件不会发送吗?
<?php
session_start();
$contact=$_POST['contact'];
$phone=$_POST['telephone'];
$email=$_POST['email'];
$msg=$_POST['message'];
$to="webform@xxx.com";
$subject="Contact Form";
$from=$email;
$message .= '<table border="1px" width="50%" style="border:1px black solid;margin:0px auto">';
$message .= '<tr><th colspan="2" style="text-align:center">Contacts Information</th></tr>';
$message .= '<tr><td>Name :- </td><td>'.$contact.'</td></tr>';
$message .='<tr> <td>Phone No. :- </td><td>'.$phone.'</td></tr>';
$message .= "<tr><td>Email :- </td><td>" . $email . "</td></tr>";
$message .= "<tr><td>Message :- </td><td>" . $msg. "</td></tr>";
$message .= "</table>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
mail($to, $subject, $message, $headers);
header("Location: sent.html");
|
answer1: |
回答1: |
Their is a typo error in your code.
$contact=$_POST['contact'];
$phone=$_POST['telephone'];
$email=$_POST['email'];
$msg=$_POST['message'];
$to="webform@xxx.com";
$subject="Contact Form";
$from=$enm; //this should be $from=$email
CAUTION: ur not validating user input. Pls do validate them server side to avoid errors and attack attempts.
If u have any other error pls state it clearly. |
他们是你的代码中的一个拼写错误。
$contact=$_POST['contact'];
$phone=$_POST['telephone'];
$email=$_POST['email'];
$msg=$_POST['message'];
$to="webform@xxx.com";
$subject="Contact Form";
$from=$enm; //this should be $from=$email
警告:UR不验证用户输入。请验证他们的服务器端,以避免错误和攻击企图。
如果您有任何其他错误请说明清楚。 |
php
contact-form
|
|