Page 1 of 1

File attachments (image/png): Fix issue with sending email

Posted: 21 Nov 2020, 17:51
by georgood
Hello!

Getting the following error when sending emails through AWS.
554 Transaction failed: Expected '/', got ; (in reply to end of DATA command))
In my case (TYPO3v9.x, Aimeos-v20.x), I am getting an error while sending the order email. Since there is a logo in the letter layout.
The problem is visible in the original letter (as some servers miss this error). The file type and name are confused:
Content-Type: aimeos.png; name="image/png"
Content-Transfer-Encoding: base64
Content-ID: <f93088b537466e83f6d6cf0e03474c84@shop.v9>
Content-Disposition: inline; filename="image/png"
The problem is solved by fixing the error in the file extension code:
aimeos/Resources/Private/Extensions/ai-typo3/lib/custom/src/MW/Mail/Message/Typo3.php

The line:

Code: Select all

public function embedAttachment( string $data, string $mimetype, string $filename ) : string
{  
    ....
	$part = \Swift_EmbeddedFile::newInstance( $data, $mimetype, $filename );
    ....
}
Replaced by:

Code: Select all

public function embedAttachment( string $data, string $mimetype, string $filename ) : string
{  
    ....
	$part = \Swift_EmbeddedFile::newInstance( $data, $filename, $mimetype );
    ....
}
The email content now has the correct values and the email is sent with images attached.
Content-Type: image/png; name=aimeos.png
Content-Transfer-Encoding: base64
Content-ID: <c05c8b9a10beed55ff845f6721252473@swift.generated>
Content-Disposition: inline; filename=aimeos.png
Thanks for your hard work. Always happy to help)))

Re: File attachments (image/png): Fix issue with sending email

Posted: 21 Nov 2020, 18:11
by aimeos
Thank you very much for investigating the cause of that issue!
We are very happy if users have found a problem and its solution :-)

Can you create a pull request with the required change here?
https://github.com/aimeos/ai-typo3/blob ... /Typo3.php

Re: File attachments (image/png): Fix issue with sending email

Posted: 21 Nov 2020, 18:24
by georgood
Can you create a pull request with the required change here?
No. Sorry, no time. Do it yourself, please.

Re: File attachments (image/png): Fix issue with sending email

Posted: 21 Nov 2020, 18:52
by aimeos

Re: File attachments (image/png): Fix issue with sending email

Posted: 21 Nov 2020, 19:06
by georgood
You made the wrong fix. The correct arguments are: "$data, $filename, $mimetype"

Best.

Re: File attachments (image/png): Fix issue with sending email

Posted: 22 Nov 2020, 08:55
by aimeos

Re: File attachments (image/png): Fix issue with sending email

Posted: 22 Nov 2020, 09:52
by georgood
Yes)))