教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 PHPMailer实现邮件发送例子

PHPMailer实现邮件发送例子

发布时间:2016-10-26   编辑:jiaochengji.com
教程集为您提供PHPMailer实现邮件发送例子等资源,欢迎您收藏本站,我们将为您提供最新的PHPMailer实现邮件发送例子资源
在php中我们在linux服务器安装了邮件组件可以直接使用mail函数发送邮箱,对于windows系统我们多半使用PHPMailer实现邮件发送了,下面来看一个简单的例子。

使用PHPMailer类实现邮件的发送。

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy5116')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy5116>

$phpmailer = new PHPMailer();
$phpmailer->IsSMTP();  // 用smtp协议来发
 
$phpmailer->Host = 'smtp.163.com';
$phpmailer->SMTPAuth = true;
$phpmailer->Username = '******'; //163邮箱帐号 @163前面的那个
$phpmailer->Password = '******'; //密码
 
// 可以发信了
 
$phpmailer->From = '*****@163.com';   //邮箱地址
$phpmailer->FromName = 'yanjiadong';
$phpmailer->Subject = '欢迎你注册,你的激活邮件';
$phpmailer->Body = '请点击进行激活';
 
// 添加收件人
$phpmailer->AddAddress('********@qq.com','用户名');
 
// 发信
 
echo $phpmailer->send()?'ok':'fail';

注意phpmailer组件下载可以百度搜索一下。

您可能感兴趣的文章:
phpmailer发送yahoo邮件的例子
phpmailer 类发送邮件乱码解决方法
PHPmailer邮件群发的入门例子
PHPMailer发送邮件代码实例(ubuntu系统)
phpmailer发送网易126邮箱的例子
phpmailer发送gmail邮件的例子
PHPMailer邮件标题中文乱码的解决方法
PHPMailer发送邮件中文附件名乱码的解决办法
phpmailer发邮件中文乱码问题如何解决
phpmailer类实现邮件群发的实例代码

[关闭]
~ ~