Closed ZoTyA1975 closed 7 years ago
$mail->message->html
or $mail->message->plain
Closed as solved.
$mail->message->plain ... results in an error: Undefined property: stdClass::$plain
$mail->message->html ... returns the complex object above (see question) - no idea how to get the html from this object. This question is not answered in my opinion
DISCOVERY 1: $mail->message->plain is wrong, it's $mail->message->text
DISCOVERY 2: $mail->message->html->__get('body') ... will give you the html body of the email.
$mail->message->text->__get('body') ... will give you the text body of the email.
NOTE: You have to check if ->html is an object (same for ->text), because each of them can be null and then __get() would cause a fatal error.
Hello,
I'd like to get only the body from a message (the _body part). How can I do that?
`SSilence\ImapClient\SubtypeBody Object ( [charset] => iso-8859-2 [_structure:SSilence\ImapClient\Section:private] => stdClass Object ( [type] => 0 [encoding] => 1 [ifsubtype] => 1 [subtype] => PLAIN [ifdescription] => 0 [ifid] => 0 [lines] => 18 [bytes] => 306 [ifdisposition] => 0 [ifdparameters] => 0 [ifparameters] => 1 [parameters] => Array ( [0] => stdClass Object ( [attribute] => CHARSET [value] => ISO-8859-2 )
blabla )`