Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the symbolic link setup for /usr/sbin/sendmail which points to my exim directory /usr/sbin/exim4/ and my php.ini pointing to /usr/sbin/sendmail. My mail isn't sending. I don't know what to do, but when I tried to reconfigure, it just shows the gui and goes straight to the next bash line with twomuchwork:~# 1;2c1;2c1;2c.

Update: I checked my iptables to make sure 25 was open. I think it might have something to do with google apps. At this point, I just want to be able to use Google apps and send mail using PHP's mail(). I have some web applications that requires the mail(). I even tried this post: http://serverfault.com/questions/54069/how-to-setup-ubuntu-mail-server-with-google-apps

Update2: I tried almost everything out there. I tried setting up exim4 as smarthost, I tried sendmail, everything works when I send a e-mail to my @gmail.com from terminal, but I still cannot get my PHP mail() to work.

share|improve this question

3 Answers 3

Interesting, dialog appears to be broken on your system for some reason. Try

dpkg-reconfigure -freadline exim4-config

Can you send email from the terminal (eg mail foo@example.com -s "subject goes here" then entering an email body ending with a . on a line by itself)? Is /usr/sbin/sendmail/ a typo, or do you really have a / on the end, because that shouldn't be there.

share|improve this answer
    
Hahaha, that is a typo. –  Doug Oct 31 '10 at 14:27
    
It works when I send it from the terminal, but not from php. –  Doug Oct 31 '10 at 14:41
    
What does exim's log show when you try sending from PHP? –  DerfK Oct 31 '10 at 17:38
    
I only see a mainlog in /var/log/exim4 and it doesn't say anything significant there. Just says 2010-10-31 20:09:08 Start queue run: pid=6389 2010-10-31 20:09:08 End queue run: pid=6389 –  Doug Oct 31 '10 at 20:31

You seem to think this problem is in some way related to PHP. IME that's very rarely the case, but you've not provided any details of how your php is configured for mail.

It works when I send it from the terminal, but not from php

Can you provide a transcript showing how you sent it from the CLI. Also the permissions for the binary. What happens when you replicate the CLI commands using popen() in php?

share|improve this answer
    
For the record, I don't think this problem is related to PHP; I am saying I cannot send mail with PHP because of a reason I don't know of. I can provide details if I knew what to provide; I said I do not know what to do, and I hope to get help and direction here. With that said, I am trying to send using a foo.php using the mail() of PHP. Also, this is the command I used echo "This is a test." | mail -s Testing someone@somedomain.com from this guide: library.linode.com/email/exim/send-only-mta-debian-5-lenny –  Doug Nov 1 '10 at 11:10
    
The "mail" command is not how PHP sends mail. However its worth checking what happens when you try to exec this from PHP. Your ini file should contain something like 'sendmail_path = /usr/sbin/sendmail -t '. You need to check that the binary is where its supposed to be and that it reads the envelope from the headers supplied in the message on stdin. –  symcbean Nov 2 '10 at 10:22

If the machine is not supposed to receive incoming email try to install nullmailer:

# apt-get install nullmailer
# dpkg-reconfigure nullmailer

This is not a solution to your problem, especially if the machine is supposed to receive mail too. But it is an effort to walk around it.

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.