[GH-ISSUE #866] Sending an email with no body causes fatal PHP error #502

Closed
opened 2026-02-25 21:35:11 +03:00 by kerem · 0 comments
Owner

Originally created by @PaulTGG on GitHub (Jan 13, 2024).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/866

Originally assigned to: @mercihabam on GitHub.

🐛 Bugreport

The fatal error leaves users with a blank screen. Example error:

[Fri Jan 12 16:41:04.080582 2024] [proxy_fcgi:error] [pid 26227] [client deleted] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /usr/local/share/cypht/modules/core/message_functions.php:438\nStack trace:\n#0 /usr/local/share/cypht/modules/core/message_functions.php(438): DOMDocument->loadHTML()\n#1 /usr/local/share/cypht/modules/core/message_functions.php(41): HTMLToText->__construct()\n#2 /usr/local/share/cypht/modules/smtp/hm-mime-message.php(244): convert_html_to_text()\n#3 /usr/local/share/cypht/modules/smtp/hm-mime-message.php(92): Hm_MIME_Msg->prep_message_body()\n#4 /usr/local/share/cypht/modules/smtp/modules.php(730): Hm_MIME_Msg->get_mime_msg()\n#5 /usr/local/share/cypht/lib/modules_exec.php(177): Hm_Handler_process_compose_form_submit->process()\n#6 /usr/local/share/cypht/lib/modules_exec.php(155): Hm_Module_Exec->run_handler_module()\n#7 /usr/local/share/cypht/lib/dispatch.php(221): Hm_Module_Exec->run_handler_modules()\n#8 /usr/local/share/cypht/lib/dispatch.php(191): Hm_Dispatch->process_request()\n#9 /...'

@marclaporte suggested the user be prompted if they try to send an email with a blank body or subject. A good idea, and it would also be nice if it was an option that could be toggled.

Version & Environment

Rev: Not sure, but it was the master on January 5.

OS: Debian 12.4.0

Steps to reproduce

  1. Try sending an email with an empty body.
  2. Done.
Originally created by @PaulTGG on GitHub (Jan 13, 2024). Original GitHub issue: https://github.com/cypht-org/cypht/issues/866 Originally assigned to: @mercihabam on GitHub. ## 🐛 Bugreport The fatal error leaves users with a blank screen. Example error: [Fri Jan 12 16:41:04.080582 2024] [proxy_fcgi:error] [pid 26227] [client *deleted*] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /usr/local/share/cypht/modules/core/message_functions.php:438\nStack trace:\n#0 /usr/local/share/cypht/modules/core/message_functions.php(438): DOMDocument->loadHTML()\n#1 /usr/local/share/cypht/modules/core/message_functions.php(41): HTMLToText->__construct()\n#2 /usr/local/share/cypht/modules/smtp/hm-mime-message.php(244): convert_html_to_text()\n#3 /usr/local/share/cypht/modules/smtp/hm-mime-message.php(92): Hm_MIME_Msg->prep_message_body()\n#4 /usr/local/share/cypht/modules/smtp/modules.php(730): Hm_MIME_Msg->get_mime_msg()\n#5 /usr/local/share/cypht/lib/modules_exec.php(177): Hm_Handler_process_compose_form_submit->process()\n#6 /usr/local/share/cypht/lib/modules_exec.php(155): Hm_Module_Exec->run_handler_module()\n#7 /usr/local/share/cypht/lib/dispatch.php(221): Hm_Module_Exec->run_handler_modules()\n#8 /usr/local/share/cypht/lib/dispatch.php(191): Hm_Dispatch->process_request()\n#9 /...' @marclaporte suggested the user be prompted if they try to send an email with a blank body or subject. A good idea, and it would also be nice if it was an option that could be toggled. ### Version & Environment <!-- Paste Git-Commit ID or Tag-Name here --> Rev: Not sure, but it was the master on January 5. <!-- Specify your OS and OS Version here if the issue is (most likely) platform dependent. --> OS: Debian 12.4.0 ### Steps to reproduce 1. Try sending an email with an empty body. 2. Done.
kerem closed this issue 2026-02-25 21:35:11 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#502
No description provided.