使用PHP的电子邮件问题 [英] Email Problem using PHP

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

问题描述

我试图通过我的反馈表发送和发送电子邮件,似乎没有任何东西通过。我曾尝试发送到雅虎帐户和Gmail帐户。我已经多次在我的脚本中更改了一些内容,并且在大约1天之后收到了几封电子邮件。截至目前,我什么都没得到。有人可以看看我的剧本并告诉我我做错了什么。另外,我如何防止邮件进入批量/垃圾邮件?这可能是我的网络托管公司的一个问题吗?


Form.php

[php]

< form method = "交" action =" sendfeedback.php">

< div align =" center">

< p align =" center">< font face =''Verdana''>联系我们< / font> < / p>

< p>反馈< br>

< textarea name =" message"行= QUOT; 5英寸cols =" 50">< / textarea>< / p>

< p>您的电子邮件:

< input name =" email"类型= QUOT;文本" />< / p>

< p>< input type =" submit" value ="发送反馈 />< / p>

< / div>

< / form>


SendFeedback.php


<?php


//收到发件人的电子邮件


$ from = $ _REQUEST [''email''];


//定义电子邮件的接收者


$ to =''支持@ mysite.com'';


//电子邮件的主题


$ subject =''反馈表格结果'';


//定义要发送的消息。


$ message = $ _REQUEST [''message''];


//定义标题


$ headers ="来自:''$ from''\\\ nnReply-To:''$ from''" ;;


// send电子邮件


$ mail_sent = @mail($ to,$ subject,$ message,$ headers);


echo $ mail_sent? "< br>< font face =''Verdana''size =''3''color =''green''>发送邮件,感谢您的反馈< / font>" :"< br>< font face =''Verdana''size =''3''color =''green''>邮件失败< / font>" ;;


?> [/ php]

I am attempting to send and email via my feedback form and nothing seems to go thru. I have tried sending to a yahoo account and a gmail account. I have changed a few things in my script several times and did receive a couple emails about 1 day later that just went into bulk. As of now I receive nothing. Can someone please take a look at my script and tell me what I am doing wrong. Also how do I prevent mails from going to bulk/spam? Could this be an issue with my web hosting company ?

Form.php
[php]
<form method="post" action="sendfeedback.php">
<div align="center">
<p align="center"><font face=''Verdana'' >Contact Us</font> </p>
<p>Feedback<br>
<textarea name="message" rows="5" cols="50"></textarea></p>
<p>Your Email:
<input name="email" type="text" /></p>
<p><input type="submit" value="Send Feedback" /></p>
</div>
</form>


SendFeedback.php

<?php

//get the senders email

$from = $_REQUEST[''email''] ;

//define the receiver of the email

$to = ''support@mysite.com'';

// subject of the email

$subject = ''Feedback Form Results'';

//define the message to be sent.

$message = $_REQUEST[''message''] ;

//define the headers

$headers = "From: ''$from''\r\nReply-To: ''$from'' ";

//send the email

$mail_sent = @mail( $to, $subject, $message, $headers );

echo $mail_sent ? "<br><font face=''Verdana'' size=''3'' color=''green''>Mail sent, Thank You for your Feedback</font>" : "<br><font face=''Verdana'' size=''3'' color=''green''>Mail failed</font>";

?>[/php]

推荐答案

from =


_REQUEST [''email''];


//定义电子邮件的接收者

_REQUEST[''email''] ;

//define the receiver of the email


to =''support@mysite.com'' ;


//电子邮件的主题

to = ''support@mysite.com'';

// subject of the email


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

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