I have been trying for TOO long to make the PHP mail() function work. On Windows, I had a little program called "Test mail server tool" which worked like a charm. No. configuration needed, no nothing. Just run it, and it would catch all mails sent to port 25.
All I really want is to be able to check how emails are being sent, I don't really want them to be sent.
I tried many options:
- Using Python as SMPT server (http://serverfault.com/questions/207619/how-to-setup-a-fake-smtp-server-to-catch-all-mails)
- Using FakeSMPT (https://nilhcem.github.io/FakeSMTP/)
- Actually using sendmail. I couldn't get it to work, I'm not that patient.
- Using MailCatcher (http://mailcatcher.me/)
I'm currently trying to make the latter work. But no matter what I try, mail() returns false and nothing is being sent to mailcatcher. This is my current php.ini
- Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=localhost
; http://php.net/smtp-port
smtp_port=2525
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = nahuel@nahueljose.com.ar
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
; sendmail_path = /usr/bin/env catchmail -f nahuel@nahueljose.com.ar
; sendmail_path = /usr/local/bin/catchmail
sendmail_path = "/usr/bin/env /usr/local/bin/catchmail"
And I run mailcatcher on port 2525 (I also tried their default port, same result). I tried using port 25, but mailcatcher says it's in use? At first it was, by sendmail, but I completely removed it and made sure port 25 wasn't being used ( sudo netstat -noa | grep ':25' ). Mailcatcher insists it is in use.
When I check /opt/lampp/logs/error_log, this appears at the end EVERY TIME I use mail()
- Code: Select all
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': /usr/lib/x86_64-linux-gnu/ruby/2.1.0/digest/md5.so: symbol MD5_Init, version OPENSSL_1.0.0 not defined in file libcrypto.so.1.0.0 with link time reference - /usr/lib/x86_64-linux-gnu/ruby/2.1.0/digest/md5.so (LoadError)
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/net/smtp.rb:23:in `<top (required)>'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail.rb:8:in `<module:Mail>'
from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail.rb:2:in `<top (required)>'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /var/lib/gems/2.1.0/gems/mailcatcher-0.6.1/bin/catchmail:7:in `rescue in <top (required)>'
from /var/lib/gems/2.1.0/gems/mailcatcher-0.6.1/bin/catchmail:3:in `<top (required)>'
from /usr/local/bin/catchmail:23:in `load'
from /usr/local/bin/catchmail:23:in `<main>'
So it seems the problem is really with mailcatcher, but noone has this problem! Googling around the error (parts of it), someone said it might be because I have an old version of OpenSSL (vulnerable to heartbleed) so I manually updated OpenSSL to 1.0.1g (openssl version returns correct version). No change.
So, all I really need is to be able to see how emails are being sent. This is important to me because it needs to work locally before I upload to an online server.
Thank you!