2009-05-11

如何使用swift发送邮件

类归于: symfony — 标签:, kthiz2006 @ 16:24

首先在项目的lib下建立vendor的文件夹
然后
svn checkout http://swiftmailer.svn.sourceforge.net/svnroot/swiftmailer/tags/php5/3.3.3/lib/ swift
接着把svn剪出的文件夹里的文件放到vendor目录下.
这样就可以使用swift发送邮件了
下面是一个简单的例子

<?php
try
{
// Create the mailer and message objects
$mailer = new Swift(new Swift_Connection_NativeMail());
$message = new Swift_Message('Mail\'s subject', $mailBody, 'text/html');
// Send
$mailer->send($message, $mailTo, $mailFrom);
$mailer->disconnect();
}
catch (Exception $e)
{
$mailer->disconnect();
// handle errors here
}
?>

评论暂缺 »

还没有任何评论。

这篇文章上的评论 RSS feed TrackBack URL

留下评论

WordPress 所驱动