Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to set up SSMTP on my Raspberry PI(Raspbian Wheezy(Debian ARM port)) Model B, Right now I can send mail through the console just fine, actually getting the mail aswel.

The problem is when I try to send mail through PHP, it seems to send it to another domain/sub-domain.

The console sends it to mail.justcandan.com:587, which works, PHP sends it through mail.pi.justcandan.com (standard port 25), while is should be the same as the console.

Heres one line that is repeated in the log

May  6 22:27:24 plaatjescollectie sm-mta[312]: r46AfkKJ025954: to=<www-data@pi.justcandan.com>, delay=11:45:38, xdelay=00:00:00, mailer=esmtp, pri=6420000, relay=mail.pi.justcandan.com., dsn=4.0.0, stat=Deferred
: Connection timed out with mail.pi.justcandan.com.

And heres my the sendmail_path part of my php ini(/etc/php5/apache2/php.ini)

[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = localhost
; http://php.net/smtp-port
;smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "/usr/bin/sendmail -t -i -f pi@justcandan -r stefan@justcandan.com"

So what am I doing wrong? I don't understand how console sendmail works just fine, but in php it's not working.

Okay I got it working, had my sendmail_path wrong, sendmail is located in /usr/sbin/ not /usr/bin. But now I still got a problem, even though my mail is physically "sent" it never get to my mail box, weird.

This is my mail.log, when sending through php:

May  7 05:43:02 raspberrypi sSMTP[4426]: Creating SSL connection to host
May  7 05:43:02 raspberrypi sSMTP[4426]: SSL connection using RSA_AES_128_CBC_SHA1
May  7 05:43:03 raspberrypi sSMTP[4426]: Sent mail for pi@justcandan.com (221 vserver104.axc.nl closing connection) uid=33 username=www-data outbytes=378

This is my mail.info, when sending through php:

May  7 05:43:02 raspberrypi sSMTP[4426]: Creating SSL connection to host
May  7 05:43:02 raspberrypi sSMTP[4426]: SSL connection using RSA_AES_128_CBC_SHA1
May  7 05:43:03 raspberrypi sSMTP[4426]: Sent mail for pi@justcandan.com (221 vserver104.axc.nl closing connection) uid=33 username=www-data outbytes=378

All of the other mail. files in /var/log are empty. Apache2 logs are only returning a favicon not found, but that doesn't matter.

EDIT: Appearantly, my Pi wasn't responding, and after 10 minutes, I started to get the mails. So I guess I fixed this myself.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Okay, so to fix this I had to to set sendmail_path in php.ini to

"/usr/sbin/sendmail -t -i -f pi@justcandan -r stefan@justcandan.com".

After that I editted /etc/ssmtp/ssmtp.conf and changed the rewrite domain to justcandan.com

After that I added an alias in revaliases in /etc/ssmtp/

www-data:my@mail.com:mail.domain.tld:587

after restarting apache, and waiting till my PI responded, it send me the mail.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.