Call to undefined function mailparse_msg_create()

If you get the following error message in PHP, it means the mailparse PHP extension is missing.

Call to undefined function mailparse_msg_create()

1. Install mailparse via PECL

You can install the mailparse extension via PECL, using the following command:

pecl install mailparse

Note: if you get an error saying /bin/sh: re2c: command not found then look over here for the solution on how to install it.

2. Add mailparse extension to PHP.ini

After installing the mailparse extension, activate it by appending the following to the end your PHP.ini file.

extension=mailparse.so

Afterwards, restart php-fpm or apache/httpd. For example for CentOS 8 you would use:

service httpd restart

Now the mailparse extension should be available to PHP and the error message should dissappear!

Published
Categorized as PHP

By Leendert de Borst

Freelance software architect with 10+ years of experience. Expert in translating complex technical problems into creative & simple solutions.

Leave a comment

Your email address will not be published.