Solved

PHP mail from prompt

Posted on 2014-04-15
5
222 Views
Last Modified: 2014-07-08
mail command works from PHP web script but not when I run it from prompt.

I run it by root and everything else in the script is working well, including updating database, etc.

Running CentOS with PHP 5.2.7

Here is php.ini mail dump:
# /usr/bin/php -i | grep -i mail | more
mail.force_extra_parameters => no value => no value
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
Path to sendmail => /usr/sbin/sendmail -t -i
MAIL => /var/spool/mail/root
_SERVER["MAIL"] => /var/spool/mail/root
_ENV["MAIL"] => /var/spool/mail/root
0
Comment
Question by:flowerbloom
  • 3
5 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40002881
No points for this please...

... with PHP 5.2.7
PHP 5.2 is not supported any more (not for several years) and is not supported even for security fixes.  My recommendation is to drop what you're doing and upgrade PHP now to PHP 5.4+ or PHP 5.5+ so you do not become the victim of an attack.  Then try this application again and come back to EE if you still are experiencing troubles.
0
 
LVL 19

Expert Comment

by:xterm
ID: 40004155
Please post your mail() command, and then tell us any output from it when you run it from the command line.  Also, look at the last few lines of the mail log at the time you send (tail -10 /var/log/maillog) and then afterwards, look in /var/spool/mqueue and /var/spool/clientmqueue to see if your mails are sitting there waiting to go out.

You might also turn up the debug level in your PHP script temporarily to get more output on what is or what is not working.

Your situation is unusual in that usually things will work fine when run as root from the CLI, but not so much when run via Apache's restricted environment.
0
 
LVL 1

Author Comment

by:flowerbloom
ID: 40041654
# mail -s subject person@domain.com
text
CTRL-D
cc: CTRL-D
#
0
 
LVL 1

Accepted Solution

by:
flowerbloom earned 0 total points
ID: 40174810
Emails were blocked by the firewall.  Firewall configuration has been modified, everything is well.
0
 
LVL 1

Author Closing Comment

by:flowerbloom
ID: 40182250
I research the issue and found a solution.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SonarQube on Linux vs Windows 3 28
maybe no no httpd.conf 6 48
Number of hours between date in DB and now 8 18
How do I fix this UPDATE error? 7 24
There was an incident about the POP3 issue for the double read receipts and delivery receipts in Exchange 2013.  There was huge research been done and found solution for the duplicate mails. Especially when the user gets  duplicate mails.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question