Problem/Motivation

If you use phpmailer_smtp as formatter (enabling HTML email format) and you configure a webform to send two emails, the second one will be generated with a nested multi-part content which breaks the rendering. Using the old Mime Mail module everything works as expected.

Steps to reproduce

  1. Enable webform
  2. Enable phpmailer_smtp
  3. Configure a webform with two notification emails. Both with "Send email as HTML" enabled.
  4. Submit a webform: the first email will be correctly sent, the second one will not.

Email example:

Here is an example of wrongly generated email (the second email sent by webform using phpmailer_smtp html formatter). I've skipped the email header which is fine.

MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="b1_qCeTsAcsomiFvZxK1BQHgClHhdEY3ZC0bCaYTpi8A"

--b1_qCeTsAcsomiFvZxK1BQHgClHhdEY3ZC0bCaYTpi8A
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8Bit

PLAIN_TEXT_CONTENT

--b1_qCeTsAcsomiFvZxK1BQHgClHhdEY3ZC0bCaYTpi8A
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8Bit

This is a multi-part message in MIME format.

--b1_GhacZBcxRpcyNoMsvHfBqa3IIApNHz2yh1GkrwG3cY
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

PLAIN_TEXT_CONTENT


--b1_GhacZBcxRpcyNoMsvHfBqa3IIApNHz2yh1GkrwG3cY
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

HTML_TEXT_CONTENT

--b1_GhacZBcxRpcyNoMsvHfBqa3IIApNHz2yh1GkrwG3cY--


--b1_qCeTsAcsomiFvZxK1BQHgClHhdEY3ZC0bCaYTpi8A--

As you can see, inside the text/html section, there is again a section with text/plain content which is wrong because it's already available.

CommentFileSizeAuthor
#3 3324504-3.patch1017 bytesimclean

Comments

FiNeX created an issue. See original summary.

imclean’s picture

Priority: Normal » Major

Thanks for the detailed report, I'll look into it. I'd categorise this as major.

imclean’s picture

Status: Active » Needs review
StatusFileSize
new1017 bytes

Just needed a slight refactoring. Please review.

finex’s picture

Hi, the patch works fine. I've tested on a couple of different websites and it works as expected. Thank you very much @imclean.

  • imclean committed fa581b5 on 2.2.x
    Issue #3324504 by imclean, FiNeX: Nested multi-part content on second...
imclean’s picture

Status: Needs review » Fixed
imclean’s picture

Thanks. This has been included in 2.2.0-alpha3.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.