自动发送电子邮件的PHP表单

自动发送电子邮件的PHP表单,php,html,Php,Html,我已经创建了一个HTML表单,输入名为“name”、“email”、“mobile”、“message” 在我的HTML中,我使用了 <form action='form_script.php' method='post'> 提前感谢您抽出时间。 萨姆 HTML表单 <table style='width:100%'> <form action='form_script.php' method='post'>

我已经创建了一个HTML表单,输入名为“name”、“email”、“mobile”、“message”

在我的HTML中,我使用了

<form action='form_script.php' method='post'>
提前感谢您抽出时间。 萨姆

HTML表单

<table style='width:100%'> 
            <form action='form_script.php' method='post'>
            <tr> 
                <th> <input type='text' required placeholder='Name' name='name' /> </th> <th> <input type='text' required placeholder='Email' name='email' /> </th> 
            </tr> 

            <tr> 
                <th> <input type='text' required placeholder='Mobile' name='mobile' /> </th> <th> <input type='text' required placeholder='Subject' name='subject'  /> </th> 
            </tr>
            <tr> 
                <th colspan='2'><textarea required placeholder='Message' name='message' ></textarea></th> 
            </tr>
            <tr> 
                <th><input id='send_form' type='submit' /> </th>
            </tr>
            </form>
        </table> 

如果您试图在本地主机上发送电子邮件,则应根据您的ISP在php.ini中设置电子邮件设置

这是我的国家(克罗地亚)isp名称(T-Com):

但这取决于isp和国家


PS.ini_集(“SMTP”、“mail.t-com.hr”);和“ini_集(“SMTP_端口”、“25”);”可以从php.ini中的代码或集合中调用。而是切换到Mailgun或phpmailer,您可以将其自动加载到代码中并以这种方式发送邮件。它比mail()函数更快、更可靠。以邮枪为例;您可以通过该网站查看日志,查看您的邮件是否100%发送。祝您好运

您没有任何名称为class='submit'的输入。 将此添加到您的表单中


由于您的代码显示
if(isset($\u POST['submit'])
,但未设置
$\u POST['submit']

您是在本地主机上还是在计算机上运行此设置?使用one.com作为我的服务器。为什么不将
$设置为=”enquiries@firelineband.co.uk";
?@NenadVracar你是什么意思?你在提交按钮上没有
name=“submit”
,如果你有足够的声誉,在评论框中回答此类内容。看看我编辑的答案
<table style='width:100%'> 
            <form action='form_script.php' method='post'>
            <tr> 
                <th> <input type='text' required placeholder='Name' name='name' /> </th> <th> <input type='text' required placeholder='Email' name='email' /> </th> 
            </tr> 

            <tr> 
                <th> <input type='text' required placeholder='Mobile' name='mobile' /> </th> <th> <input type='text' required placeholder='Subject' name='subject'  /> </th> 
            </tr>
            <tr> 
                <th colspan='2'><textarea required placeholder='Message' name='message' ></textarea></th> 
            </tr>
            <tr> 
                <th><input id='send_form' type='submit' /> </th>
            </tr>
            </form>
        </table> 
ini_set("SMTP", "mail.t-com.hr");
ini_set("smtp_port", "25");

$message = "";

if(mail('aaaa@gmail.com', 'title', $message, "From: bbbb@gmail.com"))
{
    echo 'sent succesfull';
}