You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.
The issue seems to be that calling getBody on Swift_Mime_SimpleMimeEntity before actually sending the email makes the given attachment empty.
Body of the attachment is read from the file, and it is instance Swift_ByteStream_FileByteStream. So when I call getBody it does return a string containing the body of an attachment. But the attachment is empty.
I can reproduce this by calling getBody twice:
var_dump($attachment->getBody());
// Dumps a string that contains attachment body
var_dump($attachment->getBody());
// Dumps an empty string
As far as I can tell, read method of Swift_ByteStream_FileByteStream does not reset read handle correctly, because when I call $os->setReadPointer(0) before return of the _readStream method of the Swift_Mime_SimpleMimeEntity body is correctly returned each time.
Edit: Swiftmailer version is Swift-5.2.2-DEV and PHP version is PHP 5.6.0
The text was updated successfully, but these errors were encountered:
This PR was merged into the 5.3-dev branch.
Discussion
----------
Reset read pointer
Please reference #551 for description.
Commits
-------
b17fe20 Reset read pointer
The issue seems to be that calling
getBody
onSwift_Mime_SimpleMimeEntity
before actually sending the email makes the given attachment empty.Body of the attachment is read from the file, and it is instance
Swift_ByteStream_FileByteStream
. So when I callgetBody
it does return a string containing the body of an attachment. But the attachment is empty.I can reproduce this by calling
getBody
twice:As far as I can tell,
read
method ofSwift_ByteStream_FileByteStream
does not reset read handle correctly, because when I call$os->setReadPointer(0)
before return of the_readStream
method of theSwift_Mime_SimpleMimeEntity
body is correctly returned each time.Edit: Swiftmailer version is Swift-5.2.2-DEV and PHP version is PHP 5.6.0
The text was updated successfully, but these errors were encountered: