[SOLVED] adding headers and missing autoFlush()
Posted: Sat Mar 03, 2007 3:06 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I've been looking through the docs and am unsure of how to add some extra headers. I see that there's a Swift_Message_Headers class, but how do i use it? I mean, i see the add() method, but how should i go about instantiating the class? And, once i do, how does it attach to the message? The docs for the Message class say this about the attach() method:
"Any descendant of Swift_Message_Mime can be added safely"
but Swift_Message_Headers isn't a descendant.
Also, in bringing my code up to date with ver. 3 i can't find anything analogous to the autoFlush(). Is this no longer necessary? Or is there some other mechanism available? I'm using the AntiFlood plugin. This is how i've refactored so far:
...Code: Select all
try
{
$swift = new Swift(new Swift_Connection_SMTP('localhost'));
$swift->attachPlugin(new Swift_Plugin_AntiFlood(100, 10), 'anti-flood');
set_time_limit(0);
ignore_user_abort();
flush();
/* Old code. How does this change? */
$swift->autoFlush(FALSE);
$message = new Swift_Message(EMAIL_SUBJECT_NEWSLETTER);
$message->setCharset('utf-8');
$message->setReplyTo(EMAIL_NEWSLETTER);
$message->setReturnPath(EMAIL_WEBMASTER);
/* i'd like to add some other other headers here somewhere */
$message->attach(new Swift_Message_Part($plain_content));
$message->attach(new Swift_Message_Part($html_content, 'text/html'));
...
}
catch etc.feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]