Page 1 of 1

Basic headers?

Posted: Sun Sep 16, 2007 3:28 am
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:

Posted: Sun Sep 16, 2007 8:00 am
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).

Posted: Sun Sep 16, 2007 10:14 am
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