Skip to content

Instantly share code, notes, and snippets.

@christianchristensen
Created November 12, 2011 05:16
Show Gist options
  • Save christianchristensen/1360081 to your computer and use it in GitHub Desktop.
Save christianchristensen/1360081 to your computer and use it in GitHub Desktop.
Drupal quickstart sendmail/email .txt dump script
#!/usr/bin/php
<?php
$content = file_get_contents('php://stdin');
preg_match('|^To: (.*)|', $content, $address);
$filename = "/home/quickstart/websites/logs/mail/" . date('Y-m-d_H:i:s') . '--' . $address[1] . '.txt';
file_put_contents($filename, $content);
chmod($filename, 0666);
exit();
?>
# Configure email collector
# Taken from: http://drupalcode.org/project/quickstart.git/blob/refs/heads/7.x-1.x:/quickstart-6-devenv.sh#l176 / http://drupalcode.org/project/quickstart.git/blob/refs/heads/7.x-1.x:/config/sendmail.php
mkdir -p /home/quickstart/websites/logs/mail
chmod -R 777 /home/quickstart/websites/logs/mail
sudo sed -i 's/;sendmail_path =/sendmail_path=\/home\/quickstart\/quickstart\/config\/sendmail.php/g' /etc/php5/apache2/php.ini /etc/php5/cli/php.ini
chmod +x /home/quickstart/quickstart/config/sendmail.php
@christianchristensen
Copy link
Author

Note this is altering sendmail_path in php.ini

sendmail_path=/path/to/sendmail.php

@MrMaksimize
Copy link

If you're running Drupal and have SMTP settings you may need to force them off:

In your settings.php file look for smtp_library:

$conf['smtp_library'] = NULL;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment