Anti-Flood-Plugin
Posted: Mon Apr 02, 2007 11:49 am
Hi,
actually I try to setup a newsletter script with swift (never used it before) but it seems to be a little bit complicated
... this is what i've collected out of many many posts in the forum or the documentation 
... but it causes this error:
It's very confusing when you're working the first time with Swift ... seems to be a very nice class, but very complicated
I started playing around the last hours and sending normal emails and stuff is no problem, but I was unable to solve this error myself :/
thx for suggestions and help!
Valentin
actually I try to setup a newsletter script with swift (never used it before) but it seems to be a little bit complicated
Code: Select all
<?
require(GLOBAL_PATH .'core/libs/swift/Swift.php');
require(GLOBAL_PATH .'core/libs/swift/Swift/Connection/SMTP.php');
require(GLOBAL_PATH .'core/libs/swift/Swift/Plugin/AntiFlood.php');
$obj_swift =& new Swift(new Swift_Connection_SMTP("localhost"));
/** snip **
* getting stuff from db
* $arr_recipients[] -> mail@domain.com
* $arr_newsletter[] -> newsletter contents
*/
$obj_swift->attachPlugin(new Swift_Plugin_AntiFlood(100, 30), "anti-flood");
if($arr_newsletter['art'] == 'text'):
$obj_swift->addPart($arr_newsletter['inhalt']);
else:
$obj_swift->addPart($arr_newsletter['inhalt'], 'text/html');
endif;
set_time_limit(0); ignore_user_abort();
echo "Close the browser window now...";
flush(); ob_flush();
$obj_swift->send($recipients, "\"". $arr_newsletter['name'] ."\" <". $arr_newsletter['email'].">", $arr_newsletter['title']);
$obj_swift->close();
?>... but it causes this error:
Code: Select all
Fatal error: Call to undefined method Swift::addPart()I started playing around the last hours and sending normal emails and stuff is no problem, but I was unable to solve this error myself :/
thx for suggestions and help!
Valentin