Download a Attachment from email
Closed this issue · 1 comments
ernie76 commented
How can I download a attachment from an email?
i have this code:
`
foreach ($test as $item) {
$anlage = GraphHelper::$appClient->users()
->byUserId($email)
->messages()
->byMessageId($mailID)
->attachments()
->byAttachmentId($item->getId())
->get()
->wait()
;
}`
but in the variable $anlage there is no content from the attachment. only getName, getContentType, .....
ernie76 commented
I have found it
`
foreach ($attachments->getValue() as $item) {
$anlage = GraphHelper::$appClient->users()
->byUserId($email)
->messages()
->byMessageId($mailID)
->attachments()
->byAttachmentId($item->getId())
->get()
->wait()
;
$ausgabe[$mailID][] = base64_decode($anlage->getContentBytes());
}
`