【发布时间】:2011-09-22 20:30:14
【问题描述】:
PFB 我的代码
<html>
<head>
<title> Your information</title>
</head>
<body>
<?php
$x = $_POST['yourname'];
$email = $_POST['email'];
$msg="Your Name is $x.";
$to='abc@gmail.com';
$sub='Your information';
$header = "From: ". $x . " <" . $email . ">\r\n";
ini_set("SMTP","smtp.gmail.com" );
ini_set('sendmail_from', 'abc@gmail.com');
//$email is entered as abc@gmail.com
if(mail($to, $sub, $msg,'From:' . $email)){
echo 'success';
}
else{
echo 'failure';
}
echo 'Thanks for submitting your information<br/>';
echo 'Your Name ' . $x . '<br/>' ;
echo 'Email ' . $email . '<br/>' ;
echo $msg;
?>
</body>
</html>
我已经用我的 gmail 帐户 (POP/SMTP) 配置了我的 Outlook 2007。 并且 php.ini 设置是 SMTP= smtp.gmail.com smtp_port= 587。这些设置也与outlook设置相匹配。
我得到的只是在我的浏览器上打印的“失败”。 请帮忙。
【问题讨论】:
标签: php