Enable and Configure SMTP Service in Magento 2.4.2

Keywords: Magento - Virtual Machines - Technical issue - Email configuration (SMTP)
Hi Everyone,

I am trying to install the SMTP service in my Bitnami Magento 2.4.2 virtual environment running on VirtualBox. I have allocated 4GB RAM and 2 Cores of CPU to this VM. I have no issue running the Magento instance.

When I tried to deploy the Magepal Extension to enable SMTP service following this guide - https://docs.bitnami.com/virtual-machine/apps/magento/configuration/install-extension-smtp/

During the update of dependencies, it is giving an error -

mmap () failed: [12] Cannot allocate memory

map () failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 2063605760) (tried to allocate 4096 bytes) in phar:///opt/bitnami/php/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223

After it displays errors, it comes back to the prompt again.

Can anyone please guide me to the correct direction to resolve this?



My VirtualBox configuration for this VM

Naweed - Bitnami Magento 2.4.2 Magepal SMTP install start
Starting the Extension deployment

Naweed - Bitnami Magento 2.4.2 Magepal SMTP Install Fail
The installation fails

Hi @naweedqadir

Thanks for using Bitnami Magento!

From the error message, it seems that the process failed because it could not allocated enough memory while it was updating dependencies. Magento is a demanding application in terms of resources and sometimes you can face these types of errors.

In order to solve that, here is my proposed workaround!

  1. Stop all your running services to free up some memory during the installation process:
$ sudo /opt/bitnami/ctlscript.sh stop
  1. Try again and see if the installation fails. In that case, increase the maximum memory PHP is allowed to allocate:

Modify your /opt/bitnami/php/etc/php.ini file as follows:

; Maximum amount of memory a script may consume
; http://php.net/memory-limit
- memory_limit = 2G
+ memory_limit = 3G

Once your plugin has been installed (and all the dependencies updated :slightly_smiling_face: ) you can revert the changes.

Best regards,
Jose Antonio Carmona

Was my answer helpful? Click on :heart:

1 Like

Thanks, @jcarmona for replying to my message with a possible solution. I will be applying your proposed changes and try to redeploy it again. I will come back today with the result.



Dear @jcarmona,

Thanks for your instructions. The issue was related to the scarcity of resources. I had to stop the services and also needed to increase the PHP memory limit to 3 GB. Then and only I could deploy the Extension using Composer.

The official instruction from Bitnami that I followed need to add the following in order to have the deployment of the extension within Magento without any issue -

Once the deployment of the Extension via Composer completed;


Before going to the next step, I restarted all the services including Apache, MariaDB, and PHP


Then I updated the Magento configuration to add the new extension by going to the Magento directory

cd /opt/bitnami/magento

and executing this following command -

sudo bin/magento-cli module:enable --clear-static-content MagePal_GmailSmtpApp


Then I ran the following command to include the new extension in Magento Admin -

sudo bin/magento-cli setup:upgrade


In the end, the success screen came up.


Since I used a free Gmail account to test this extension, I needed to ensure this Gmail account allowed “Less secure app access”.

I used the default configuration of this extension within Magento Admin

The default configuration uses SMTP Port 465 (SSL). If the test of Email Server Configuration Settings failed, then I would have changed it to 587 to support TLS. But I did not have to do it.

I put one of my work Email ID in Email address and From Email Address -

Clicked on “Send Test Email” button. Voila :slight_smile: it worked.

In my work Email, I received two Emails to confirm the deployment was successful -


Thank you for your prompt reply and for pointing me in the correct direction. Have a great day.



1 Like

Hi @naweedqadir

Thank you so much for the screenshots and the detailed walkthrough!

Glad to see you were able to solve your issue! We are marking the previous answer as “Solution” and this topic as “Closed”.

If you have any other questions, please do not hesitate to let us know. Feel free to create a new topic referencing this one if necessary.

Best regards,
Jose Antonio Carmona

Was my answer helpful? Click on :heart:

1 Like