我的php邮件功能不工作? [英] My php mail function is not working?

查看:145
本文介绍了我的php邮件功能不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下PHP代码:

<?
if ($_POST['emailme']) {
$yemail = $_POST['email'];
$host = $_SERVER['HTTP_HOST'];
$email = "<autoreply@$host>";
if (mail('$yemail', 'This is a Subject', 'This is the body of the email', 'From: $email')) {
echo "Message sent!";
} else {
echo "Message failed sending!";
}
}
?>

这是我的HTML:

<FORM METHOD="POST" ACTION=""><INPUT TYPE='TEXT' CLASS='BOX' NAME='email' /><INPUT TYPE='SUBMIT' NAME='emailme' CLASS='SUBMITBOX' VALUE='Send!' /></FORM>

任何想法为什么不发送电子邮件?消息已发送,但在收件箱中没有收到任何电子邮件

Any ideas why its not sending the email ? it says Message Sent but im not receiving any emails in my inbox

所有帮助都非常感谢,谢谢

All help is much appreciated, thanks

PS:ive尝试了以下(带双引号):

PS: ive tried the following (with double quotes):

if (mail("$yemail", "This is a Subject", "This is the body of the email", "From:" . $email))  {
echo "Message sent!";
} else {
echo "Message failed sending!";
}

但仍然没有运气

推荐答案

尝试这个

if (mail('akh40@hotmail.co.uk', 'This is a Subject', 'This is the body of the email', 'From:'. $email)) 

这篇关于我的php邮件功能不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆