我想通过SMTP发送邮件 [英] i wanna send mail via smtp in php
本文介绍了我想通过SMTP发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的页面中,我首先有html正文
我有
smtp服务器: | <输入类型=文本" name ="srv" value ="smtp.gmail.com"/> |
...
所以我想在我的php代码中输入该文本如何?
我这样做$ mail-> Host = $ _GET [''srv''];
但是我看到这个错误了
SMTP->错误:无法连接到服务器:由于目标计算机主动拒绝连接,因此无法建立连接. (10061)
请帮助
in my page first i have html body
and i have
smtp server : | <input type=''text'' name="srv" value="smtp.gmail.com" /> |
...
so i wanna in there in my php code take that text how??
i do this $mail->Host = $_GET[''srv''];
but i see this erroe
SMTP -> ERROR: Failed to connect to server: No connection could be made because the target machine actively refused it. (10061)
help please
推荐答案
mail->主机=
mail->Host =
_GET [''srv''];
但是我看到这个错误了
SMTP->错误:无法连接到服务器:由于目标计算机主动拒绝连接,因此无法建立连接. (10061)
请帮助
_GET[''srv''];
but i see this erroe
SMTP -> ERROR: Failed to connect to server: No connection could be made because the target machine actively refused it. (10061)
help please
这不是这样做的方法.在最简单的情况下,您可以使用具有属性method="post"
的HTML表单,并将一些数据发布到服务器.您的PHP脚本应处理此数据,创建一个电子邮件程序包,并将其从服务器端发送到SMTP服务器:
http://php.net/manual/en/function.mail.php [ ^ ].
现在,为您一个大警告:如果您在未经适当验证的情况下直接进行操作,您的主机很快就会变成僵尸,从而发送垃圾邮件或类似内容.
请查看我过去的答案以获取更多详细信息:
无法发送邮件,它显示了以下代码中的错误. [
This is not how it''s done. In the simplest case, you can have an HTML form with the attributemethod="post"
and post some data to your server. Your PHP script should process this data, create a e-mail package and send it from the server side to the SMTP server:
http://php.net/manual/en/function.mail.php[^].
Now, a big warning for you: if you do it directly without proper validation, your host can be turned into a zombie sending spam, or something like that, in no time.
Please see my past answer for further detail:
unable to send mail , it showing the error in below code .[^].
Be safe.
—SA
这篇关于我想通过SMTP发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文