Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-01-2009, 05:06 AM   #1
LQ Newbie
Registered: Mar 2009
Posts: 3

Rep: Reputation: 0
Debian etch - Unable to send mail from command line or from php mail command


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:

$message = "Line 1\nLine 2\nLine 3";
$message = wordwrap($message, 70);
mail('', 'My Subject', $message);

Any help would be really appreciated. Thanks.

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

Last edited by lqforumuser; 03-01-2009 at 05:41 AM. Reason: More info
Old 03-01-2009, 07:56 AM   #2
Registered: May 2008
Location: Romania
Distribution: Debian
Posts: 242

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

You shouldn't find 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

Last edited by ddaemonunics; 03-01-2009 at 08:01 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to send mail with php mail() command - minimum config required? FeathersMc Linux - Server 2 10-26-2008 01:21 AM
unable to send mail using Mail command navin_karnam Linux - Newbie 3 05-13-2008 03:21 AM
command line email client to send mail to remote mail server dhanju Linux - Software 1 03-07-2008 07:37 AM
Unable to send mail using mail command faruque.ahmed Linux - Software 1 02-03-2007 11:29 AM
Cannot send mail with mail() command in PHP 4.3.4, Apache 2.0.48, Mandrake Linux 10 arcanum Linux - General 3 06-27-2004 07:06 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration