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

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
georgood
Posts: 7
Joined: 21 Nov 2020, 17:22

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

Post by georgood » 21 Nov 2020, 17:51

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)))

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

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

Post by aimeos » 21 Nov 2020, 18:11

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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

georgood
Posts: 7
Joined: 21 Nov 2020, 17:22

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

Post by georgood » 21 Nov 2020, 18:24

Can you create a pull request with the required change here?
No. Sorry, no time. Do it yourself, please.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

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

Post by aimeos » 21 Nov 2020, 18:52

Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

georgood
Posts: 7
Joined: 21 Nov 2020, 17:22

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

Post by georgood » 21 Nov 2020, 19:06

You made the wrong fix. The correct arguments are: "$data, $filename, $mimetype"

Best.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

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

Post by aimeos » 22 Nov 2020, 08:55

Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

georgood
Posts: 7
Joined: 21 Nov 2020, 17:22

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

Post by georgood » 22 Nov 2020, 09:52

Yes)))

Post Reply