Getting the following error on a drush scripted install
WD user: Session opened for admin. [6.44 sec, 21.33 MB] [notice]
sh: 1: -t: not found
WD mail: Error sending e-mail (from drmiaow@gmail.com to drmiaow@gmail.com). [8.36 sec, 21.15 MB] [error]
WD cron: Cron run completed. [8.37 sec, 21.14 MB] [notice]
Unable to send e-mail. Contact the site administrator if the problem persists. [8.38 sec, 21.13 MB] [error]
Command dispatch complete [8.38 sec, 21.11 MB] [notice]
Timer Cum (sec) Count Avg (msec)
page 8.286 1 8286.17
drupal_http_request 1.007 1 1007.47
Does anyone know how to please stop Drush/Drupal from sending an email on site-install?
Thanks.
Comments
Comment #1
DrMiaow commentedComment #2
moshe weitzman commentedDrupal is doing this. We fixed this with a php.ini setting in our CI setup. Some pseudocode:
php -d sendmail_path=/dev/null drush ....Comment #3
patcon commentedNice. Great advice for travis ci
https://github.com/myplanetdigital/myplanet/blob/19b8b3c85463d677c7de1c5...
Comment #4
DrMiaow commentedI get
Comment #5
DrMiaow commentedAnd under linux if I point it at /usr/sbin/sendmail instead of /dev/null I get
Comment #6
greg.1.anderson commentedMaybe try
php -d sendmail_path=/path/to/executable/that/does/nothing, and then make an executable file that contains only:Comment #7
DrMiaow commentedThanks.
In the end I opted for
php -d sendmail_path=`which true` ...which expanded to
php -d sendmail_path=/bin/true ...Which did the same as you suggested, without the need for a fake app the returns true.
Does not solve the issue for Windows though, but at least I have something to go on.
Thanks Again!
Comment #9
cantoute commentedThis is an old question, but for next one looking for how to block php mail function
(perhaps that information would have a better place on the wordpress documentation... it's actually to block wordpress sites turning into spam machines that i use that
no need to create that script
is part of unix base and is called
/bin/truein php.ini
sendmail_path=/bin/trueUnder unix, process that exits with a non zero value indicate it failed
so to block mails silently (php will believe the mail is sent) you would want /bin/true
if you want php to know that sent has failed then replace with /bin/false
Comment #10
hawkeye.twolfFor others who stumble across this, one part that wasn't totally obvious to me: You need to pass in the actual drush.php script instead of the drush binary.
In my vagrant box, drush.php was at /usr/share/php/drush/drush.php
Comment #11
greg.1.anderson commentedCalling drush.php is deprecated. Instead, do this:
/usr/bin/env PHP_OPTIONS='d sendmail_path=`which true`' drush site-installComment #12
hawkeye.twolfThanks Greg! Yes that would be much better. But it doesn't work for me on Drush 6.2, 6.5, or 7-alpha6. With the code you posted, I get "Could not open input file: d".
I think you missed a dash in front of the "d" in
PHP_OPTIONS='d sendmail_path=`which true`'But after fixing it I still get "Could not open input file: true`"
Any ideas? Thanks.
Comment #13
greg.1.anderson commentedSorry for the typos!
Test:
/usr/bin/env PHP_OPTIONS="-d sendmail_path=`which true`" drush ev 'return ini_get("sendmail_path");'So, for site install, then, use this:
/usr/bin/env PHP_OPTIONS="-d sendmail_path=`which true`" drush site-install ...Comment #14
hawkeye.twolfThe double quotes fixed it. Thanks!
Comment #15
guardian87 commentedJust used this on a CI setup on codeship.
Works like charm!
Thanks for this.
Comment #16
JulienD commented@guardian87 which version of PHP and Drush do you use? I work for me on 5.6 but not on php 7.
Edit: I had to update to the latest version of Drush using composer instead of the Phar build. Worked like a charm in this case.
Comment #17
jasonawantFWIW, you can use the following to disable the email notification.
drush site-install standard install_configure_form.update_status_module='array(FALSE,FALSE)'https://drushcommands.com/drush-8x/core/site-install/
Comment #18
jasonawantIn 8.3.x, the SiteConfigureForm form structured changed, so now it's
drush site-install standard install_configure_form.enable_update_status_module=NULLSee https://github.com/drush-ops/drush/pull/2675 and https://github.com/drush-ops/drush/pull/2676
Comment #19
Anonymous (not verified) commented@jasonawant ++ for this info. My CI setup was failing because of the failed email during installation.
Comment #20
twfahey commentedThank you @jasonawant
Comment #21
nattsThank you also @jasonawant. Instead of messing around trying to set-up e-mail on Windows IIS, I can just use your:
install_configure_form.update_status_module='array(FALSE,FALSE)'argument on my 'drush si profile-name' command (for D7).