LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-24-2004, 01:21 AM   #1
arcanum
LQ Newbie
 
Registered: Jun 2004
Location: New Zealand
Distribution: Fedora
Posts: 2

Rep: Reputation: 0
Unhappy Cannot send mail with mail() command in PHP 4.3.4, Apache 2.0.48, Mandrake Linux 10


Hey Everyone,

I know this has been asked before, but all of the responses give fixes that don't seem to work for me, or are related to routing through Windows servers, or are just to difficult to understand for a newbie like me :-)

I have been using Linux for a couple of weeks now, and am basically setting up a LAMP platform. So far, although it has taken me a while to get here, I have managed to get most things working. I am using Linux Mandrake 10. I have installed "Apache-AdvancedExtranetServer/2.0.48 (Mandrake Linux/5mdk)" (or so it says), PHP 4.3.4, MySQL (not sure what version, how do I check?), and phpMyAdmin etc.

Everything seems to be working now except the mail() command in PHP. Whenever I try to send mail, the function just returns False, and the mail isn't sent. I have looked at the various other posts concerning this, but still can't get it to work.

FYI, I am connected via a LAN to another computer which has a direct connection (ADSL) to the Internet. My Internet is working fine, and so is the Evolution mailer (although I am using IMAP so don't know about POP/SMTP). I have run ps x to see what is running (as suggested elsewhere), and can't see anything about sendmail or postfix in there. I have taken a look at PHP configuration using phpinfo(), and here is what I have found concerning mail:

sendmail_from me@localhost.com me@localhost.com
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i

In case these details help anyone, this is what Apache spits out if I force it to do a 403 error:

Apache-AdvancedExtranetServer/2.0.48 (Mandrake Linux/5mdk) mod_perl/1.99_11 Perl/v5.8.3 mod_ssl/2.0.48 OpenSSL/0.9.7c PHP/4.3.4 Server at video.arknet Port 80

Oh btw, I just now (halfway through writing this) tried:
/usr/sbin/sendmail -t -i
In the console. It started sendmail and the PHP mail() function no longer returned False, however, the mail is still not coming through. I have tried sending to numerous addresses, and none have arrived, so I am guessing it is sending and not receiving that is the problem. Now I have two problems:

1. How do I get the emails to ACTUALLY send instead of just saying they are sent? and...
2. How do I make sendmail always start instead of having to do it manually?

Any help would be greatly appreciated. Just ask for any additional info you might need. Please also remember that I am REALLY new so 'check the log files' doesn't make sense to me :-) How about...go to directory X and open log Y....look for a line that looks like Z...that would be great thanks.

Cheers,
Arcanum
 
Old 06-24-2004, 02:58 AM   #2
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
Hi!

Haven't played that much with PHP mail() func yet. I am guessing you have some kind of sendmail problem - and sendmail configuration is a whole WORLD on its own.

I have managed to get sendmail going on my local network only, but I am guessing you need it to send out over the Internet?

Anyway, as regards you one question, as to how to get sendmail to start every time your Linux box starts, you can try this (I use RedHat, so it might not work for you). Edit /etc/rc.local and at the very end of the rc.local file, add the sendmail starting command. This file is a script that is run each time Linux starts (or at least RedHat) and so by the time you either log into X or see a Console prompt, it has been run. My rc.local looks like this:

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
esd &
loadkeys /root/mykeys
/usr/sbin/nmbd -D
/usr/sbin/smbd -D
/usr/local/mysql/bin/mysqld_safe --user=mysql &
/usr/local/apache2/bin/apachectl start

BTW I also use LAMP for active website development.

Hope this helps some!
dhcpd -q
 
Old 06-27-2004, 04:47 PM   #3
arcanum
LQ Newbie
 
Registered: Jun 2004
Location: New Zealand
Distribution: Fedora
Posts: 2

Original Poster
Rep: Reputation: 0
Thumbs up

Hey rylan76,

Thanks for that info, worked well! I now have sendmail running all of the time, so the mail() command 'thinks' it works now (it returns True), but I still have the problem that it doesn't actually seem to send it. Does anyone know how to configure sendmail to get it to work?

Cheers,
Arcanum
 
Old 06-27-2004, 07:06 PM   #4
bulliver
Senior Member
 
Registered: Nov 2002
Location: British Columbia, Canada
Distribution: Gentoo x86_64; FreeBSD; OS X
Posts: 3,762
Blog Entries: 4

Rep: Reputation: 78
In php.ini:
Code:
; For Win32 only.
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = sendmail -t -i
You want "sendmail_from = me@example.com" commented out when using linux (note the "For Win32 only")

Also, check the address you are using in the "from" argument to the mail() function. Unless your mail server allows relaying, (not good) you will have to use a real address from a user that exists on your system ie: you@yourdomain.com
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send mail from command line buskmann Linux - Newbie 7 07-23-2006 11:18 PM
I cant get postfix to send with mail command roller24 Linux - Newbie 1 11-28-2005 04:21 PM
can i send mail from command line? iflorea Linux - Software 6 11-02-2005 08:08 AM
Command Line Send Mail nutthick Linux - Newbie 10 01-24-2005 08:52 PM
send mail via PHP from website on apache. not working mdkelly069 Linux - Software 0 02-25-2004 01:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:26 AM.

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