请问php是如何使用附件发送邮件的。 [英] Pls how is php used to send mail with attachment.
本文介绍了请问php是如何使用附件发送邮件的。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请知道以下内容。 PHP;
如何用php发送附件。
如何用php发送html电子邮件。
Pls I wish to know the following about. PHP;
How are attachments sent with php.
How are html emails sent in php.
推荐答案
两种主要方法是:
非常基本: http://www.w3schools.com/php/func_mail_mail.asp [ ^ ]
具有多个接口,基于PEAR存储库:
http://pear.php.net/package/Mail [ ^ ],
http://pear.php.net/manual/en/package.mail.mail.php [ ^ ],
http://en.wikipedia.org/wiki / PEAR [ ^ ],
http://pear.php.net/ [ ^ ]。
用于添加附件,特别是如果您必须处理更低级别,重要的是要理解没有任何内容真正附加,所有内容都嵌入在多部分邮件内容的一个文本块中,该内容被细分为部分,每个部分具有单独的MIME内容类型;不适合文字演示的部分通常用base64编码:
http://en.wikipedia。 org / wiki / E-mail_attachment [ ^ ],
http://en.wikipedia.org/wiki/Base64 [ ^ ]。
这就是如何在PHP中使用base64: http://php.net/manual/en/ function.base64-encode.php [ ^ ]。
现在,为您提供大警告:从网页上的用户数据发送邮件是一个最受欢迎的安全漏洞如果此类输入未正确清理,则很容易将Web服务器的主机变为发送垃圾邮件的僵尸或类似的东西。请看我过去的回答:
无法发送邮件,它显示以下代码中的错误。 [ ^ ]。
-SA
Two major methods are:
Very basic: http://www.w3schools.com/php/func_mail_mail.asp[^]
With multiple interfaces, based on the PEAR repositiory:
http://pear.php.net/package/Mail[^],
http://pear.php.net/manual/en/package.mail.mail.php[^],
http://en.wikipedia.org/wiki/PEAR[^],
http://pear.php.net/[^].
For adding "attachments", especially if you have to work on the lower level, it's important to understand that nothing is really "attached", everything is embedded in one text block of a multipart mail content, which is subdivided into "parts" each having its separate MIME content type; parts not suitable for text presentations are usually encoded in base64:
http://en.wikipedia.org/wiki/E-mail_attachment[^],
http://en.wikipedia.org/wiki/Base64[^].
This is how base64 can be used in PHP: http://php.net/manual/en/function.base64-encode.php[^].
Now, a big warning for you: sending mails out from the user data on a Web page is one of the most "popular" security holes. If such input is not properly sanitized, it is easy to turn your Web server's host into a zombie sending spam or something like that. Please see my past answer:
unable to send mail , it showing the error in below code .[^].
—SA
查看各种解决方案这里 [ ^ ]
See various solutions here[^]
这篇关于请问php是如何使用附件发送邮件的。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文