This morning I ran a deployment on a fresh Magento Cloud environment and suddenly got the below SMTP error right after setup:upgrade, which was very unusual.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
[2021-02-23 06:42:08] INFO: Running setup upgrade. [2021-02-23 06:56:37] INFO: Set flag: var/.deploy_is_failed [2021-02-23 06:56:37] ERROR: [126] The command "/bin/bash -c "set -o pipefail; php ./bin/magento setup:upgrade --keep-generated --ansi --no-interaction | tee -a /app/var/log/install_upgrade.log"" failed. sendmail: /etc/msmtprc: line 6: command host needs an argument [2021-02-23 06:56:37] INFO: Set flag: var/.deploy_is_failed W: W: In Processor.php line 129: W: W: The command "/bin/bash -c "set -o pipefail; php ./bin/magento setup:upgrade W: --keep-generated --ansi --no-interaction | tee -a /app/var/log/install_up W: grade.log"" failed. sendmail: /etc/msmtprc: line 6: command host needs an a W: rgument W: W: W: In InstallUpdate.php line 100: W: W: The command "/bin/bash -c "set -o pipefail; php ./bin/magento setup:upgrade W: --keep-generated --ansi --no-interaction | tee -a /app/var/log/install_up W: grade.log"" failed. sendmail: /etc/msmtprc: line 6: command host needs an a W: rgument W: W: W: In Setup.php line 58: W: W: The command "/bin/bash -c "set -o pipefail; php ./bin/magento setup:upgrade W: --keep-generated --ansi --no-interaction | tee -a /app/var/log/install_up W: grade.log"" failed. sendmail: /etc/msmtprc: line 6: command host needs an a W: rgument W: W: W: In Shell.php line 86: W: W: The command "/bin/bash -c "set -o pipefail; php ./bin/magento setup:upgrade W: --keep-generated --ansi --no-interaction | tee -a /app/var/log/install_up W: grade.log"" failed. sendmail: /etc/msmtprc: line 6: command host needs an a W: rgument W: W: W: deploy W: |
I had a look at the recent changes and found a mail() function in the modules InstallSchema.php script.
1 2 3 4 5 6 |
$to_email = 'sdfsdf@sdfsdf.com'; $subject = 'New Installation of sdfsdfsdf M2 extension'; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= 'From: ' . $merchantmail . '' . "\r\n"; mail($to_email, $subject, $body, $headers); |
In this particular case, a 3rd party module developer has implemented a tracking system to notify his agency about new module installations. It may work on some hosting platforms, but obviously not on Magento Cloud during the build process.