Page 1 of 1
Using Variable in Message Part
Posted: Thu Apr 17, 2008 3:59 pm
by jackfranklin
Hi,
$message->attach(new Swift_Message_Part($themessage));
Is that possible? I've tried doing it, it gives no errors, but doesn't display the message.
Any help greatly appreciated!
Re: Using Variable in Message Part
Posted: Thu Apr 17, 2008 7:27 pm
by Chris Corbyn
Where's the rest of your code? That is certainly possible so something else must be getting done incorrectly

Re: Using Variable in Message Part
Posted: Fri Apr 18, 2008 12:52 pm
by jackfranklin
$swift = new Swift(new Swift_Connection_SMTP("my smtp"));
$message = new Swift_Message($subject);
$message->attach(new Swift_Message_Part($themessage));
$message->attach(new Swift_Message_Part("Part of my message", "text/html"));
$recipients =& new Swift_RecipientList();
$recipients->addTo($to);
//Use addCc()
$recipients->addCc($cc);
$recipients->addBcc($bcc);
//Now check if Swift actually sends it
if ($swift->send($message, $recipients, "
email@mysite.com"))
My only thought is that it is not finding the variable $themessage, but I'm positive it does. If you can't see anything wrong with the above I'll check again.
Re: Using Variable in Message Part
Posted: Sat Apr 19, 2008 2:25 am
by Chris Corbyn
Where does $themessage come from?

Not from a form by any chance? Have you tried:
?