Prev | Current Page 252 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"


Sending HTML formatted mail
As part of the input filtering in the createAction() method of our SupportController action, the body text is
formatted as HTML using the PHP Markdown conversion tool written by Michel Fortin and based on John
Gruber??™s original code. The formatted body is then saved in a separate field alongside the original giving us
two versions of the body to use in our email.
First we have the original body that we have been using up to now as the plain text version:
$mail->setBodyText($supportTicket->body);
Now we can use the formatted body as the HTML version of our email:
$mail->setBodyHtml($supportTicket->body_formatted);
And that is it! Well actually not quite. It??™s important to remember that if you are going to be sending an
HTML version of your email that you also send a plain text version for those who cannot or do not want to
view the HTML version.
Formatting with Zend_View
We now know how to send pre-formatted mail in plain text or HTML versions, but what if we want to do some
formatting to the email body before it is sent? Earlier, while adding recipients, we mentioned that you may
prefer to send a separate email to the support ticket submitter from the one sent to the support team. This
submitter email is the example we will use to demonstrate how Zend_View can be used to render an email
from the same kind of view script as used in our HTML pages.


Pages:
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
Kąty Rybackie noclegi trener nlp ceny żywca leczenie alkoholizmu Kołobrzeg