Error: Message body empty

Created on 18 January 2024, 11 months ago

Problem/Motivation

Recently, I have been updating some Drupal 9 sites to Drupal 10 and during testing a webform submission, I came across this bug.

Steps to reproduce

1. Create a webform with some text fields and a file upload field.
2. Setup an email handler to send an email (include file as an attachment).
3. Under Mail System (/admin/config/system/mailsystem), select Mime Mail Mailer as an formatter.
4. Now open the webform to fill fields and attach a txt file and then submit.
5. It throws an email error and on checking the DB logs, it says "Error sending e-mail from ....... to ....: Message body empty";

Proposed resolution

After spending some time on it, I have found this error is getting triggered because of empty Body. Actually, the Mime mail module sets some Content Type headers and based on those SMTP module sets Body and AltBody variables. But in this case, there are some content mentioned as text/plain and some text/html, however, SMTP only checks if there is any text/plain and puts all the content to AltBody which leaves Body empty.
So for now I have created a simple patch to check if Body empty, but I think there are some modifications needed in checking the content type header logic.

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Created by

🇨🇦Canada hargurpreet Kitchener

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024