邢晓宁专栏

08年准备勤奋写作:编程与垒砖无异,灰领无非就是懂点电脑的民工,每日编码,每日垒砖,代码一生,自得其乐。

用户操作
[即时聊天] [发私信] [加为好友]
邢晓宁ID:thefirstwind
154684次访问,排名495好友3人,关注者6
本人很简单,计算机才入门
thefirstwind的文章
原创 67 篇
翻译 0 篇
转载 21 篇
评论 92 篇
邢晓宁的公告
MY PAGE
最近评论
bluehouse1985:Linux 环境下的多核调试
— Intel + Totalview 强强联合!
目前,在软件开发行业,各种性能优异的调试工具层出不穷。但是,它们中的绝大部分都只支持windows环境。即使能支持linux平台,操作起来也很不方便。因此,对于长期在linux上编写程序的开发人员来说,如何调试就成了一个令人头痛的问题!Intel软件 和 Total……
bluehouse1985:Linux 环境下的多核调试
— Intel + Totalview 强强联合!
目前,在软件开发行业,各种性能优异的调试工具层出不穷。但是,它们中的绝大部分都只支持windows环境。即使能支持linux平台,操作起来也很不方便。因此,对于长期在linux上编写程序的开发人员来说,如何调试就成了一个令人头痛的问题!Intel软件 和 Total……
sap99:www.sap99.com/,SAP99资料多多

SAP免费资料下载
http://www.sap99.com

有很多的学习资料,推荐一下,
macnie:Mailer Error: Could not execute: /usr/sbin/sendmail
我用的是windows 2003+ apache+PHP5.2 ,我写的代码在LUINX上面运行正常,在window服务器上怎么总线上上面这个啊 ?
macnie:Mailer Error: Could not execute: /usr/sbin/sendmail
我用的是windows 2003+ apache+PHP5.2 ,我写的代码在LUINX上面运行正常,在window服务器上怎么总线上上面这个啊 ?
文章分类
收藏
相册
SITES LINK
absurd@csdn
Dailywtf
handhelds
linuxdevices
Matrix - 与 Java 共舞(RSS)
microwindows
nana
QT
webmasterworld
理想工作室
大虾小虾都是虾
○经典连接○
CNBLOGのflier(RSS)
CSDNのlei001(RSS)
LIU QACT@blogspot(RSS)
孟岩@CSDN(RSS)
曾登高@CSDN(RSS)
蒋涛@CSDN(RSS)
陈皓@CSDN(RSS)
韩磊@CSDN(RSS)
存档
订阅我的博客
XML聚合  FeedSky

原创 PHPMailer v2.0.0 新知收藏

新一篇: 为四川地震受灾者作些力所能及的事(一名普通在日技术人员的心里话) | 旧一篇: (PHP)海量数据输出CSV文件时由于特殊字符引起的CSV文件格式异常的问题解决

2007年11月,PHPMailer得下一个版本发布,作为开源软件,PHPer们已经非常熟悉该程序。最近版本v2.0.0继承了稳定版本1.7.3的标准协议,并且修改了部分的隐患,添加了对于php5的更好支持。对于class.smtp.php这个类,又添减了对于pop-before-smtp的对应,已经VERP的对应。

原文介绍如下:
PHPMailer
Full Featured Email Transfer Class for PHP
==========================================

** NOTE:

As of November 2007, PHPMailer has a new project team headed by industry
veteran Andy Prevost (codeworxtech). The first release in more than two
years will focus on fixes, adding ease-of-use enhancements, provide
basic compatibility with PHP4 and PHP5 using PHP5 backwards compatibility
features. A new release is planned before year-end 2007 that will provide
full compatiblity with PHP4 and PHP5, as well as more bug fixes.

We are looking for project developers to assist in restoring PHPMailer to
its leadership position. Our goals are to simplify use of PHPMailer, provide
good documentation and examples, and retain backward compatibility to level
1.7.3 standards.

If you are interested in helping out, visit http://sourceforge.net/phpmailer
and indicate your interest.

**

http://phpmailer.sourceforge.net/

This software is licenced under the LGPL.  Please read LICENSE for information on the
software availability and distribution.

Class Features:
- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs
- Redundant SMTP servers
- Multipart/alternative emails for mail clients that do not read HTML email
- Support for 8bit, base64, binary, and quoted-printable encoding
- Uses the same methods as the very popular AspEmail active server (COM) component
- SMTP authentication
- Native language support
- Word wrap, and more!

Why you might need it:

Many PHP developers utilize email in their code.  The only PHP function
that supports this is the mail() function.  However, it does not expose
any of the popular features that many email clients use nowadays like
HTML-based emails and attachments. There are two proprietary
development tools out there that have all the functionality built into
easy to use classes: AspEmail(tm) and AspMail.  Both of these
programs are COM components only available on Windows.  They are also a
little pricey for smaller projects.

Since I do Linux development I have missed these tools for my PHP coding.
So I built a version myself that implements the same methods (object
calls) that the Windows-based components do. It is open source and the
LGPL license allows you to place the class in your proprietary PHP
projects.


Installation:

Copy class.phpmailer.php into your php.ini include_path. If you are
using the SMTP mailer then place class.smtp.php in your path as well.
In the language directory you will find several files like
phpmailer.lang-en.php.  If you look right before the .php extension
that there are two letters.  These represent the language type of the
translation file.  For instance "en" is the English file and "br" is
the Portuguese file.  Chose the file that best fits with your language
and place it in the PHP include path.  If your language is English
then you have nothing more to do.  If it is a different language then
you must point PHPMailer to the correct translation.  To do this, call
the PHPMailer SetLanguage method like so:

// To load the Portuguese version
$mail->SetLanguage("br", "/optional/path/to/language/directory/");

That's it.  You should now be ready to use PHPMailer!

 

最后附带一个简单程序:

 

<?php
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "smtp1.example.com;smtp2.example.com";  // specify main and backup server
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "jswan";  // SMTP username
$mail->Password = "secret"// SMTP password

$mail->From = "from@example.com";
$mail->FromName = "Mailer";
$mail->AddAddress("josh@example.net", "Josh Adams");
$mail->AddAddress("ellen@example.com");                  // name is optional
$mail->AddReplyTo("info@example.com", "Information");

$mail->WordWrap = 50;                                 // set word wrap to 50 characters
$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = "Here is the subject";
$mail->Body    = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->Send())
{
   
echo "Message could not be sent. <p>";
   
echo "Mailer Error: " . $mail->ErrorInfo;
   
exit;
}

echo "Message has been sent";
?>

 

 

发表于 @ 2008年05月12日 09:12:00|评论(loading...)|编辑

新一篇: 为四川地震受灾者作些力所能及的事(一名普通在日技术人员的心里话) | 旧一篇: (PHP)海量数据输出CSV文件时由于特殊字符引起的CSV文件格式异常的问题解决

评论

#yss 发表于2008-05-17 20:45:52  IP: 221.13.149.*
下面的错误什么意思呀!
Message could not be sent.
Mailer Error: Language string failed to load: connect_host
#thefirstwind 发表于2008-05-18 08:59:22  IP: 222.0.135.*
与邮件服务器连接失败
#macnie 发表于2008-09-06 16:29:16  IP: 123.15.47.*
Mailer Error: Could not execute: /usr/sbin/sendmail
我用的是windows 2003+ apache+PHP5.2 ,我写的代码在LUINX上面运行正常,在window服务器上怎么总线上上面这个啊 ?
#macnie 发表于2008-09-06 16:29:22  IP: 123.15.47.*
Mailer Error: Could not execute: /usr/sbin/sendmail
我用的是windows 2003+ apache+PHP5.2 ,我写的代码在LUINX上面运行正常,在window服务器上怎么总线上上面这个啊 ?
发表评论  


登录
Csdn Blog version 3.1a
Copyright © 邢晓宁