Zend_Mail::setBodyText PHP Method

setBodyText() public method

Sets the text body for the message.
public setBodyText ( string $txt, string $charset = null, string $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE ) : Zend_Mail
$txt string
$charset string
$encoding string
return Zend_Mail Provides fluent interface
    public function setBodyText($txt, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE)
    {
        if ($charset === null) {
            $charset = $this->_charset;
        }
        $mp = new Zend_Mime_Part($txt);
        $mp->encoding = $encoding;
        $mp->type = Zend_Mime::TYPE_TEXT;
        $mp->disposition = Zend_Mime::DISPOSITION_INLINE;
        $mp->charset = $charset;
        $this->_bodyText = $mp;
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Notifies the customer of their delivery.
  *
  * @param \IocExample\Model\Customer $customer
  * @param \IocExample\Model\Order $order
  * @return void
  */
 public function notifyCustomerOfDelivery(Customer $customer, Order $order)
 {
     $this->_mailer->setFrom('*****@*****.**', 'Grumpy Baby Orders');
     $this->_mailer->setSubject('Order #' . $order->getId() . ' out for Delivery');
     $this->_mailer->setBodyText('Your order is being shipped!');
     $this->_mailer->addTo($customer->getEmail(), $customer->getName());
     $this->_mailer->send();
 }
All Usage Examples Of Zend_Mail::setBodyText