search
Homephp教程php手册用PHP发送MIME邮件(六)

用PHP发送MIME邮件(六)

Jun 13, 2016 am 10:30 AM
mailphpprintsworthsendandmethodyesuseofillustratemail

limodou

  值得说明的其它两个方法是print_mail()和send_mail(),两个都使用了$force参数。print_mail()输出整个邮件信息,send_mail()使用php(做为现在的主流开发语言)的mail()函数发送信息。可选的,send_mail()使用了一个SMTP对象和它的发送方法(由用户指定)来发送邮件。


结论
  创建一个符合MIME的信息不象看上去那么复杂,可以通过一个相当简单的方式来实现。MIME消息可以给许多的站点带来新气象。

  我们在上面开发的类覆盖了核心思想,并且它可以被扩展,唯一的限制是你的想象力。例如,某人可以写出detach()函数,来删除指定索引的附件(attach()方法可以返回这个信息)。

  这个MIME_mail类可以用于发送基于HTML的邮件,不需要改造,只是嵌入的图像不能被发送;这是一个
需要特别注意的主题。

  然而,没有图象的HTML或引用的图像使用了绝对URL或标记也可以使用MIME_mail类进行发送。一
个例子如下:

(做为现在的主流开发语言)

$html_data = Hello;
$mime = new MIME_mail($to, $from, $subject);
$mime->attach($html_data, "", OCTET, BASE64, INLINE);
$mime->send_mail ();

?>

  这个邮件的收信人将得到一个黑色背景和蓝色的"Hello"文本的邮件!

  发送完整的行内HTML信息,连同其它一些符合MIME邮件发送的高级专题,值得特别考虑,希望这些将成 为这篇文章的继续。

MIME_mail类,常量文件和运行实例可以在此下载zip压缩包。  

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!