- Issue created by @hargurpreet
Recently, I have been updating some Drupal 9 sites to Drupal 10 and during testing a webform submission, I came across this bug.
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";
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.
Active
1.2
Code