Basic headers?

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
Mailman
Forum Newbie
Posts: 1
Joined: Sun Sep 16, 2007 3:23 am

Basic headers?

Post by Mailman »

Hello,

I'm a bit lost, i've been looking thru the documentation and found out how to set all kinds of advanced MIME headers, but could someone just talk me thru how to set the basic header stuff like "From","Reply-to" and the likes?

I tried a forum search too but again i found only answers to more advanced questions, i guess most people are smarter than me. :wink:
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Swift_Message has a Swift_Message_Headers object within it that can be manipulated.

Swift_Message::setTo($to)
Swift_Message::setFrom($from)
Swift_Message::setReturnPath($address)
Swift_Message::setReplyTo($replyto)
Swift_Message::setCc($cc)
Swift_Message::setBcc($bcc)
Swift_Message::setSubject($subject)
Swift_Message::setDate($date)

Or, you can manually use the set() method in the Swift_Message_Headers object which can be accessed as Swift_Message::headers->set($name, $value).
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

http://www.swiftmailer.org/wikidocs/v3/ ... on/headers

And yes, in addition to the Swift_Message_Header class ($message->headers->....) there are some convenience accessors for $message->setFrom(), $message->setReplyTo() etc.

There's also an overview of the available methods in Swift_Message and Swift_Message_Headers here:

http://www.swiftmailer.org/api/php5/Swi ... ssage.html
http://www.swiftmailer.org/api/php5/Swi ... aders.html
Post Reply