LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Debian etch - Unable to send mail from command line or from php mail command (http://www.linuxquestions.org/questions/linux-newbie-8/debian-etch-unable-to-send-mail-from-command-line-or-from-php-mail-command-708342/)

lqforumuser 03-01-2009 04:06 AM

Debian etch - Unable to send mail from command line or from php mail command
 
Hi,

I have installed debian etch with no software selected other than mail server and the base system.

Once installed I ran these commands:

#apt-get install mysql-server libapache2-mod-php5 apache2
#apt-get install php5
#apt-get install php5-mysql
#apt-get install php5-gd
#apt-get install proftpd

and thats all (oh and i logged in as root and then as my user to test them, I also rebooted the server once)

- My router assigns an IP address to my debian box via its MAC address
- Port 80, 21 and 22 are forwarded on my router and I can access apache externally as well as FTP (do I need to forward an email port)
- I have no idea what mail server software was installed but it may have been postfix (whatever the default is for debian etch I guess)
- If I type:

mail "hello world" root

at the bash prompt I get "Can't send mail: sendmail process failed with error code 1"
- I am pretty sure my mail server wasn't sendmail but hey who knows
- My phpinfo.php script works when I browse to it

My goal: I have a simple php script that sends an email and I want to be able to open a web browser, point to my server and my testmail.php script and then to check my gmail account to see if I recieved it. My script should be correct but I think there is something much more fundamentally wrong or rather not yet configured on my server.

My PHP script:

<?php
$message = "Line 1\nLine 2\nLine 3";
$message = wordwrap($message, 70);
mail('myprivateemailaddress@gmail.com', 'My Subject', $message);
?>

Any help would be really appreciated. Thanks.


EDIT: I have found out that I am using exim4 mail server

ddaemonunics 03-01-2009 06:56 AM

remove exim4 and install postfix ..or
ln -s /usr/sbin/sendmail /usr/sbin/exim4
or
dpkg-reconfigure exim4-config which should create a symlink of sendmail to the exim binary.


You shouldn't find out...you should know :)
Debian defaults to using exim4 as mail server.

In php.ini there is a line that says
sendmail_path = /usr/sbin/sendmail -t -i


All times are GMT -5. The time now is 03:11 PM.