使用PHP邮件() [英] Using PHP mail( )

查看:160
本文介绍了使用PHP邮件()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个php邮件脚本,在一个主机上完美地工作。但是,当我尝试在网络解决方案主机上使用相同的脚本时,该函数返回true,但没有发送电子邮件。

  //获取邮件功能数据
$ case = $ _POST ['case'];
$ to = addslashes(strip_tags($ _ POST ['to']));
$ message = addslashes(strip_tags($ _ POST ['message']));
$ subject = addslashes(strip_tags($ _ POST ['subject']));
$ message = addslashes(strip_tags($ _ POST ['message']));
$ from =confirmation@website.co;
$ headers =From:$ from\r\\\
;

//发送电子邮件
if(mail($ to,$ subject,$ message,$ headers)){
//格式化错误消息
$ emailSent =块;
$ emailFailed =none;
}
else //如果电子邮件发送失败
{

$ emailSent =无;
$ emailFailed =block;
}
?>有没有人知道不同的主机是否需要邮件脚本中的特定信息?



$ / code $

解决方案

这是Network Solutions客户支持的问题。从共享托管服务器发送邮件通常是很好的锁定 - 如果他们允许它,它被限制。另外,调用邮件只是意味着消息已成功传递到 sendmail ,而不是邮件离开了服务器。它可能坐在排队等待发送,它可以弹出超过你控制的一百万个理由等。


I have a php mail script which works perfectly on a one host. However, when I attempt to use the same script on a network solutions host, the function returns true but no email ever sends.

//get mail function data
$case = $_POST['case'];
$to = addslashes(strip_tags($_POST['to']));
$message = addslashes(strip_tags($_POST['message']));
$subject = addslashes(strip_tags($_POST['subject']));
$message = addslashes(strip_tags($_POST['message']));
$from = "confirmation@website.co";
$headers = "From: $from\r\n";

//send email
        if (mail($to,$subject,$message,$headers)){
            //formatting for error message
            $emailSent = "block";
            $emailFailed = "none";
        }
        else //if the email fails to send
        {

            $emailSent = "none";
            $emailFailed = "block";
        }
?>

Does anyone know if different hosts require specific info in mail script?

解决方案

This is a question for Network Solutions customer support. Sending mail from shared hosting servers is usually well locked down -- if they allow it at all, it's throttled. Also, calling mail just means the message was successfully passed to sendmail, not that the mail ever left the server. It could be sitting in a queue to be sent, it could have bounced for a million reasons beyond your control, etc.

这篇关于使用PHP邮件()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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