WPManageNinja / fluent-smtp

FluentSMTP - WordPress SMTP & Email Service API connection Plugin
https://fluentsmtp.com
92 stars 45 forks source link

File attachments not working with ElasticEmail #165

Open suessbot opened 1 year ago

suessbot commented 1 year ago

I saw a fix regarding file attachments / ElasticEmail in this commit ac859f30255df523f485258f9f32a9f9bb514311 from Nov. 8 2022. It looks like this issue has been fixed. But unfortunately...

I am still facing this issue: fluentSMTP is sending an email with a small file attachment (PDF) to ElasticEmail:

Running latest versions WP 6.2, fluentSMTP 2.2.4

suessbot commented 1 year ago

Issue identified in: fluent-smtp/app/Services/Mailer/Providers/ElasticMail/Handler.php

Line 267:

266 $this->postbody[] = '--' . $this->boundary . "\r\n"; 267 $this->postbody[] = '--' . 'Content-Disposition: form-data; name="attachments' . ($i + 1) . '"; filename="' . $fname . '"' . "\r\n\r\n";

New line with Content-Disposition after boundary hast to be startet without '--' (hyphens). After removing it, file attachments work as expected with Elastic Email:

$this->postbody[] = 'Content-Disposition: form-data; name="attachments' . ($i + 1) . '"; filename="' . $fname . '"' . "\r\n\r\n";