When developing in PHP perhaps you need to set up a sendmail that just outputs things to text. No need to setup delivery via SMTP. Just create an executable ruby script somewhere, for example: /usr/bin/fake-sendmail.sh with following content:
$ touch /usr/bin/fake-sendmail.sh # make it executable (will require root priv.) $ chmod +x /usr/bin/fake-sendmail.sh
#!/usr/bin/ruby path = "/tmp/fake-mailer" Dir.mkdir(path) if !File.exists?(path) File.open("#{path}/#{Time.now.to_i}.txt", "w") do |f| f.puts ARGV.inspect $stdin.each_line { |line| f.puts line } end
Then edit php.ini
sendmail_path = /usr/bin/fake-sendmail.sh
props to dan for the script
Update
I changed one line to use a micro-time format because I was having some trouble with a very fast sending script overwriting some of the existing e-mail files. So, here is the new line to insert:
File.open("#{path}/#{(Time.now.to_f.to_s.gsub(".","")+'00000000')[0..14]}.eml", "w") do |f|
Do you need fake sendmail for windows? Check out Byron’s fake sendmail for windows.
One Response to Fake Sendmail for Mac (linux)