Skip to content

Instantly share code, notes, and snippets.

@StyleT
Created February 16, 2014 11:21
Show Gist options
  • Save StyleT/9032704 to your computer and use it in GitHub Desktop.
Save StyleT/9032704 to your computer and use it in GitHub Desktop.
Sendmail handler (SH edition)
#!/bin/sh
# Script save all letters from PHP mail function to mailFolder
# Usage: in php.ini - sendmail_path = /path/to/sendmail.sh
# TODO: detect curr folder and save files to it
mailFolder="/Users/StyleT/sendmail"
now=$(date +"%m-%d-%Y_%H-%M-%S")
num=0
name="$mailFolder/$now-$num.eml"
while [ -f name ]
do
num=$(($num + 1))
name="$mailFolder/$now-$num.eml"
done
while read line
do
echo $line >> $name
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment