[SOLVED] sendmail problems
Moderator: General Moderators
[SOLVED] sendmail problems
Hello,
New to the foum so if i'm in the wrong section i'm sorry.
I'm currently running FedoraCore 6 w/apache php 5....
My problem is very wierd. I wrote a e-mail script (aaa.php) that when I run it from the command line like so
root@localhost# php aaa.php
it works fine
but when i access it from the browser
https://mydomain.com/aaa.php
nothin happens.
no errors in /var/mail/root or the error log i specify in the code.
no traffic recorded in wireshark relvant to scipt
can any one enlighten me, If you need a log or config let me know
New to the foum so if i'm in the wrong section i'm sorry.
I'm currently running FedoraCore 6 w/apache php 5....
My problem is very wierd. I wrote a e-mail script (aaa.php) that when I run it from the command line like so
root@localhost# php aaa.php
it works fine
but when i access it from the browser
https://mydomain.com/aaa.php
nothin happens.
no errors in /var/mail/root or the error log i specify in the code.
no traffic recorded in wireshark relvant to scipt
can any one enlighten me, If you need a log or config let me know
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Code: Select all
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$message = 'A new blah<br>blah # <br>By: From ';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: cgit@mycompany.com\n";
$sentTo = "mp@theircompany.com";
if (mail($sentTo, 'Test ISA6', $message, $headers))
{
echo "An e-mail was sent to $sentTo";
} else {
echo "Not Sent to: $sentTo";
}
// Make sure that the log_errors and error_log directives are set
// in the php.ini file. They must be set for the error_log function
// to be able to write errors to the PHP error log.
// If they're not set, you can set them at runtime by
// uncommenting the two lines below.
ini_set ('log_errors', 1);
ini_set ('error_log', 'syslog');
// You can also specify a file for the error log directive.
ini_set ('error_log', '/var/log/php_error.log');
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
It may be good to run phpinfo() to check where php.ini is being loaded from for both the CLI and Apache run versions.
If they are the same then the unix command ps can often be used to find out which user Apache is running as; probably "nobody" or "www." You can then use "which" or "locate" followed by an "ls" to determine the user and group to which sendmail belongs.
Alternately you could send the mail through an SMTP server using a library such as Swift.
If they are the same then the unix command ps can often be used to find out which user Apache is running as; probably "nobody" or "www." You can then use "which" or "locate" followed by an "ls" to determine the user and group to which sendmail belongs.
Alternately you could send the mail through an SMTP server using a library such as Swift.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Perhaps PHP when running under apache is using a userid which sendmail is rejecting (e.g. "nobody"). When you run with CLI you run as the user who starts the script.mpuha wrote:feyd,
I cannot find the CLI config file... but that is the correct path for sendmail...
I did config from in sendmail section. still not working
EDIT | I should point out that it is quite common to block the use of sendmail to nobody.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
That's where my line of posts is/was leading...d11wtq wrote:Perhaps PHP when running under apache is using a userid which sendmail is rejecting (e.g. "nobody"). When you run with CLI you run as the user who starts the script.
EDIT | I should point out that it is quite common to block the use of sendmail to nobody.
so i should try changing userid on apche user and group...
also i tried swift... which i have to say id great. running in to the same problem command line works fine but when i try it througha bowser i get the following error
I'm so mind f@#ked right now trying to get this to work... sorry for being such a newb
and thanx for all your time guys
also i tried swift... which i have to say id great. running in to the same problem command line works fine but when i try it througha bowser i get the following error
Code: Select all
The mailer failed to send the mail. Errors:
Array
(
[0] => Array
(
[num] => 0
[time] => 0.76166000 1168155652
[message] => Connection to the given MTA failed. The Connection Interface said: Permission denied
)
[1] => Array
(
[num] => 0
[time] => 0.76467000 1168155652
[message] => The MTA doesn't support any of Swift's loaded authentication mechanisms
)
)
Log:
Array
(
)and thanx for all your time guys
I'm getting the same problem
Literally been trying to solve it for a week and cannot find anything that has solved it.
Does anyone have any ideas or am I stuffed? I CAN connect to the SMTP server via telnet (smtp.googlemail.com).
This is using the Wordpress plugin on FC6/Apache/PHP5.The mailer failed to connect. Errors:
Array
(
[0] => Array
(
[num] => 0
[time] => 0.31936800 1180478549
[message] => Connection to the given MTA failed. The Connection Interface said: Permission denied
)
)
Log:
Array
(
)
Literally been trying to solve it for a week and cannot find anything that has solved it.
Does anyone have any ideas or am I stuffed? I CAN connect to the SMTP server via telnet (smtp.googlemail.com).
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
It's either a permissions problem, or a firewall rule. Also, when you connect via telnet are you doing it *from* the same server? I've had a lot of people try connecting from home rather than from their web host.
That's old code too. I'm pretty sure the wordpress plugin author released a version which uses Swift 3. I could be wrong though.
That's old code too. I'm pretty sure the wordpress plugin author released a version which uses Swift 3. I could be wrong though.