LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-20-2009, 08:18 AM   #1
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Rep: Reputation: 15
php mail() not working


I know something's not right on my server -- php's mail function is not sending mail

is it a problem with sendmail (I know very little about sendmail)
is it a php configuration issue?
is it other?

I can provide access to the site if someone's willing to help
 
Old 01-20-2009, 03:53 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
First off can you post the script? It will help if we can see something. Also did you check your php.ini file to make sure it is setup correctly? And last what errors does it give in your /var/log/syslog and /var/log/messages. of course the logs can be changed if you used the ini_set() feature to output logging to another file.
 
Old 01-21-2009, 07:59 AM   #3
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
am new to this so, not sure where to check the logs
 
Old 01-21-2009, 10:45 AM   #4
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
normally you can check your logs at /var/log/messages or check your httpd.conf file and php.ini files and see where they point to for Error logs. also in your script your can add in your php file
Code:
error_reporting(E_ALL|E_STRICT);
ini_set("display_errors", false);
ini_set("error_log", "/var/log/phperror.log");
course you can change the location so that if you have a folder in your web directory called logs then the output can be placed there. Also can you post the script. It will really help us out. You may also want to set display_errors to true so that it will display an error message.
 
Old 01-21-2009, 12:51 PM   #5
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
here's a short excerpt from the mailer log:
Jan 21 00:00:02 pcbsd newsyslog[90957]: logfile turned over
Jan 21 00:08:49 pcbsd sm-mta[75682]: n0HGsPZr089826: to=<leicaphotos@gmail.com>, delay=3+12:33:48, xdelay=00:08:54, mailer=esmtp, pri=14972140, relay=gsmtp147.google.com. [209.85.147.27], dsn=4.0.0, stat=Deferred: Operation timed out with gsmtp147.google.com.
Jan 21 00:08:49 pcbsd sm-mta[75682]: n0HEMLEA001796: to=<blake@cookbooks.com>, delay=3+15:00:48, xdelay=00:00:00, mailer=esmtp, pri=15512657, relay=www.cookbooks.com., dsn=4.0.0, stat=Deferred: Operation timed out with www.cookbooks.com.
Jan 21 00:08:49 pcbsd sm-mta[75682]: n0HEVmZo007252: to=<blake@cookbooks.com>, ctladdr=<www@localhost.localdomain> (80/80), delay=3+15:37:01, xdelay=00:00:00, mailer=esmtp, pri=15600581, relay=www.cookbooks.com., dsn=4.0.0, stat=Deferred: Operation timed out with www.cookbooks.com.


so, I know it's sending

we're on a dev server, so it's moving to cookbooks.com soon - current url is www.cookbooksonline.com

www.cookbooksonline.com/phpinfo.php


so, I'm assuming I've got a dns related issue?
 
Old 01-21-2009, 02:16 PM   #6
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Ok try sending a test message from the command line. This will see if it is something in the config of sendmail or if it is in your script.
 
Old 01-21-2009, 02:58 PM   #7
3rods
Member
 
Registered: Mar 2008
Posts: 70

Rep: Reputation: 16
I think we should start at the begining first; did you setup an SMTP server and a mail from name (win32) in you php.ini file?

Search for [mail function] in php.ini file.

PHP sendmail isn't magic, it actually relays through the SMTP server - usually on the local box, but it can be remote (i.e. smtp.comcast.net)
 
Old 01-21-2009, 03:04 PM   #8
3rods
Member
 
Registered: Mar 2008
Posts: 70

Rep: Reputation: 16
I had some problems until I added the <mail from> address in the php.ini. I'm pretty sure that most mail servers do a HELO to ensure that the from email is a valid address. It helps cut down on spam.

Try the sendEmail script here:
http://caspian.dotconf.net/menu/Software/SendEmail/

It's nice to have to diagnos mail issues stuff from the command line in a very basic, granular sense.

At the very least you'll be able to narrow it down to a cofig issue with PHP.
 
Old 01-21-2009, 03:29 PM   #9
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by 3rods View Post
I think we should start at the begining first; did you setup an SMTP server and a mail from name (win32) in you php.ini file?

Search for [mail function] in php.ini file.

PHP sendmail isn't magic, it actually relays through the SMTP server - usually on the local box, but it can be remote (i.e. smtp.comcast.net)
win32 has nothing to do with this unless he has it setup on a windows machine. Also the default is to use the localhost which is fine for most installations. And as mentioned it is better to see if his actual sendmail configuration is setup properly as it looks like the script is sending mail to the server.
 
Old 01-21-2009, 04:48 PM   #10
3rods
Member
 
Registered: Mar 2008
Posts: 70

Rep: Reputation: 16
Quote:
Originally Posted by jstephens84 View Post
win32 has nothing to do with this unless he has it setup on a windows machine. Also the default is to use the localhost which is fine for most installations. And as mentioned it is better to see if his actual sendmail configuration is setup properly as it looks like the script is sending mail to the server.
Sorry, thought that might be relavant since I get a 220 reponse from a Microsoft ESMTP Mail Service (Version 6.0.3790.3959) at cookbooks.com
 
Old 01-28-2009, 02:17 PM   #11
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
bump - still not resolved -- need a little handholding here
 
Old 01-28-2009, 05:12 PM   #12
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by leicaphotos View Post
bump - still not resolved -- need a little handholding here
did you try sending and email via the command line? This will eliminate one thing from the equation. Also as mentioned please post the script so that we can review it.
 
Old 01-29-2009, 07:48 AM   #13
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
i have a simple php mail script and am seeing this from command line:

php mailtest.php
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
PHP Warning: Module 'zlib' already loaded in Unknown on line 0
1root@pcbsd# php -r mailtest.php
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
PHP Warning: Module 'zlib' already loaded in Unknown on line 0
PHP Parse error: syntax error, unexpected $end in Command line code on line 1


odd odd am thoroughly confused now
 
Old 01-29-2009, 10:28 AM   #14
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by leicaphotos View Post
i have a simple php mail script and am seeing this from command line:

php mailtest.php
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
PHP Warning: Module 'zlib' already loaded in Unknown on line 0
1root@pcbsd# php -r mailtest.php
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
PHP Warning: Module 'zlib' already loaded in Unknown on line 0
PHP Parse error: syntax error, unexpected $end in Command line code on line 1


odd odd am thoroughly confused now
Again I can't give you much in the way of help if I can't see your code.
place the code from the mailtest.php script on here between the code tags. This will give me more information to help you with your script.
 
Old 01-29-2009, 10:33 AM   #15
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
<?
print mail ('leicaphotos@gmail.com',
'No need for reply -- PHP test!', /* subject */
"hi Blake\nLine 2\n"); /* body */
?>
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Mail Not Working RAH104 Linux - Server 3 07-24-2008 10:49 AM
php mail() not working but mailx works twlilinux Linux - Server 6 07-03-2008 10:16 PM
PHP mail() function not working with Exim Madone_SL_5.5 Programming 6 12-03-2006 10:05 PM
php mail() not working sajith Programming 2 11-30-2006 11:54 AM
php mail() function not working as it should on my box juancha Linux - Newbie 14 02-16-2006 01:43 PM


All times are GMT -5. The time now is 08:49 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration