Solved can ssmtp be use in php form

Hi,
I have installed /ports/mail/ssmtp to replace sendmail on my FreeBSD 10.2 jail and it work as far as receiving the daily security run outout is concern..

But I have a contact form that uses php sendmail function to send email.
Obviously, I cannot get it to work as sendmail is not installed on system.

So my question is: Can ssmtp MTA be configured to send email on a web form?
I triying to use PHPmailer but failed to understand on to get it to work (405 - Method Not Allowed)
 
Hi Crest
/etc/mail/mailer.conf
Code:
# $FreeBSD: releng/10.2/etc/mail/mailer.conf 93858 2002-04-05 04:25:14Z gshapiro $
#
# Execute the "real" sendmail program, named /usr/libexec/sendmail/sendmail
#
#sendmail       /usr/libexec/sendmail/sendmail
#send-mail      /usr/libexec/sendmail/sendmail
#mailq          /usr/libexec/sendmail/sendmail
#newaliases     /usr/libexec/sendmail/sendmail
#hoststat       /usr/libexec/sendmail/sendmail
#purgestat      /usr/libexec/sendmail/sendmail
sendmail        /usr/local/sbin/ssmtp
send-mail       /usr/local/sbin/ssmtp
mailq           /usr/local/sbin/ssmtp
newaliases      /usr/local/sbin/ssmtp
hoststat        /usr/bin/true
purgestat       /usr/bin/true
I also set the following line in my /etc/php.ini file
Code:
sendmail_path = /usr/local/sbin/ssmtp

Could you spot what I missed?
 
I think so. You did too much. Sendmail introduced a lot of ugly now legacy behaviour into common unices. One of those is that the sendmail binary is hardlinked multiple times and dispatches on its zeroth argument. By setting the sendmail_path to ssmtp you invoke ssmtp under its normal name of "ssmtp". Leave sendmail_path to its default value and let the mailer.conf handle invoking the right binary under the name "sendmail". IIRC ssmtp emulates the required sendmail behaviour and does what is required to replace sendmail for outgoing mail.
 
I set sendmail_path back to its default value but I still get the error bellow when trying submit my php form
Code:
405 - Method Not Allowed
Does mail/ssmtp need any entry in /etc/rc.conf like sendmail do?

Also, do I need to do
Code:
mv /usr/sbin/sendmail /usr/sbin/sendmail.org
ln -s /usr/local/sbin/ssmtp /usr/sbin/sendmail
 
Note, "405 - Method Not Allowed" is a HTTP error code.

Therefore, most probably, you are looking at the wrong place for solving the issue. If you use the mail() php-function properly, then I cannot see how it could generate a 405 error. I suggest to use a test script to troubleshoot the problem. The following looks nice and comprehensible:
http://www.w3schools.com/php/func_mail_mail.asp
 
Back
Top