WPManageNinja/fluent-smtp

File attachments not working with ElasticEmail

suessbot opened this issue · 1 comments

I saw a fix regarding file attachments / ElasticEmail in this commit ac859f3 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:

  • fluentSMTP states response code 200 and all seems good
  • ElasticEmail Log doesn't show any attachments and no errors
  • Recipient receives an email without attachment.

Running latest versions WP 6.2, fluentSMTP 2.2.4

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";