首页 >> 读书频道 >> 电脑 >> 两个PHP发送邮件的例子
 
· 在网页中使用颜色
· NT下基于邮件服务软件(
· HTML标准
· 用PHP实现POP3邮件
· 介绍HTML标识符
· 什么是HTML文件?
· 用PHP实现POP3邮件
· SMTP协议原始命令码和
· POP3协议命令原始码及
· ASP教程:最新的ASP
· ASP教程:堵住ASP漏
· ASP教程:ADO 存取
 
· 拉封丹寓言
· 电视剧《刁蛮公主》下载和
· 美容养颜手册
· 加油金顺剧情分集介绍完整
· 红楼梦:120回全本[清
· 素质教育在美国
· 全唐诗卷四十六
· 韩剧《布拉格恋人》剧情介
· 夜航船[作者:明·张岱]
· 局外人[作者:韩·可爱淘
· 现场流行病学
· 源氏物语[日本:紫式部]
 
· (出租)中动商场部分及写
· (出租)中动动漫基地&#
· 喜剧学院
· 《善德女王》剧情介绍
· 魔女18号 剧情
· 丑女无敌剧情介绍
· 魔女幼熙剧情介绍
· 龙游天下剧情介绍
· 震撼世界的七日剧情介绍
· 静静的白桦林剧情介绍
· 心情日记—老公今天我想对
· 旗舰剧情介绍
欢迎来到月影社区!如果您觉得这里不错,请推荐给您的朋友们。月影社区:http://wf66.com/

两个PHP发送邮件的例子


查看有无更新版本

关键字:PHP技术 2006-9-20

 

 Send Mail in PHP
In this example, we will show how to send an email message to someone in PHP.


PHP Code:
<?php

echo "<html><body>";

mail ("karn@nucleus.com", "Subject", "Hello!");

echo "Sending mail...";
echo "</body></html>";

?>

 

It is that simple!

The PHP mail function has up to four parameters. The first parameter is the recipient of the message. The second parameter is the subject of the email message. The third parameter is the body of the message. And the fourth parameter is optional, which will be covered on the next page.

If the above example does not work when you view it in your browser then the Sendmail variable in your PHP setup file is probably not set correctly. In UNIX, it should be set to something like '/usr/sbin/sendmail -t'. Consult your PHP documentation for more in depth instructions.


Advanced Example


Here we will show the full capabilities of the PHP mail function.

PHP Code:
<?php

echo "<html><body>";

$recipient = "Kris Arndt <karn@nucleus.com>,npl@nucleus.com";
$subject = "Testing the mail function";
$message = "Hello!\n\nThis is the body of the message.\n\n";
$extra = "From: kris@phpworld.com\r\nReply-To: karn@nucleus.com\r\n";

mail ($recipient, $subject, $message, $extra);

echo "Sending mail...";
echo "</body></html>";

?>

 

We send an email to two people this time, by putting two email addresses in the recipient field and separating them with commas.

The fourth parameter holds extra headers for the email. We specify who the email was from and who the recipient should reply to. When entering multiple headers, separate them with the line feed and new line combination ('\r\n').


 

两个PHP发送邮件的例子

[ 1 ]
两个PHP发送邮件的例子 num

打印本页 关闭

关于我们版权声明本站导航友情连结作品演示 TOP↑