由于某些原因,PHP邮件无法正常工作 [英] PHP mail not working for some reason

查看:61
本文介绍了由于某些原因,PHP邮件无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是PHP的新手,我正在使用邮件功能发送无法正常工作的电子邮件.我收到一条成功消息,但仍然无法正常工作

I am new to PHP and I'm using the mail function to send emails which is not working. I get a success message, but still it does not work

相同的代码

<?php
    $email_to = "abc@abc.com";
    $email_subject = "Test mail";
    $email_body = "Hello! This is a simple email message.";


    if(mail($email_to, $email_subject, $email_body)){
        echo "The email($email_subject) was successfully sent.";
    } else {
        echo "The email($email_subject) was NOT sent.";
    }
?>

我缺少任何内容吗,我需要为此功能包括任何文件吗?.我来自asp.net&这是在网站上找到的基本脚本.

Am I missing anything, do I need to include any files for this function.. I am from asp.net & this is the basic script which found on website.

我尝试了其他与邮件相关的脚本,这些脚本也无法正常工作.

I tried other scripts related to mail they didn't work either..

我正在网站上而不是在本地主机上运行此脚本

I AM RUNNING THIS SCRIPT ON THE WEBSITE NOT on the localhost

推荐答案

这可能是配置错误.如果您坚持使用PHP mail函数,则必须编辑php.ini.

This is probably a configuration error. If you insist on using PHP mail function, you will have to edit php.ini.

(在我看来)如果您正在寻找更简单,更通用的选项,则应使用 PHPMailer .

If you are looking for an easier and more versatile option (in my opinion), you should use PHPMailer.

这篇关于由于某些原因,PHP邮件无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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