Bob Cavezza
Bob Cavezza

Reputation: 2850

Zend_Mail - how to get only html body from email?

I'm working with emails from google oauth. This is the format I'm using.

$emailmessage = $storage->getMessage($i); $fromaddress = $storage->getMessage($i)->from;

What format can I use to get only the html body of the email?

I've been looking at this document http://framework.zend.com/apidoc/core/Zend_Mail/Zend_Mail.html, but the formatting seems off. It only has getFrom, which leads me to believe it's an old version.

EDIT: I'm using Zend_Mail_Storage_Imap

Upvotes: 0

Views: 2689

Answers (1)

user228395
user228395

Reputation: 1176

The Zend_Mail_Storage_Imap will not return Zend_Mail but Zend_Mail_Message. So, you'll have to look here for the functions: http://framework.zend.com/apidoc/1.10/Zend_Mail/Zend_Mail_Message.html. As you can see it extends Zend_Mail_Part which has the getContent() method.

The way to get the body part is (in one line):

$content = $storage->getMessage($i)->getContent();

Upvotes: 1

Related Questions