• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

php mail() function not working

anyway my problem is a permission one...

Could you please tell me what permission (CHMOD) should I put all my mail files to ??,

my mail() function ain't working because of these

Thanks
 
Not sure permissions. You might want to go to www.qmail.org, thats where I started. You could also fix the qmail issue by adding an MX record going to your hostname, I am not sure if that would work, but it might be worth a try.
 
HEY I think it's coming from SELINUX try writting "setenforce 0" into your root and see if it repairs. Beware, it's only temporary until the next reboot. See if it repairs anything
 
same prob

Dear All!

I'm new with PLESK. Guess confixx was much more easy!

I've the same problem, PHP or Perl, sending mails with sendmail won't work. No error in runtime.

The PHP above works fine.

I found a lot in google, a lot people with same problem, but no solution. - Terrible!

Here's the tail of my /usr/local/psa//var/log/maillog

PHP:
Apr 15 10:49:57 h123456 qmail-queue: dwlib[10212]: mail: all addreses are uncheckable - need to skip scanning (by deny mode)
Apr 15 10:49:57 h123456 qmail-queue: dwlib[10212]: scan: the message(drweb.tmp.CEr44Q) sent by [email][email protected][/email]er_isp.net to [email][email protected][/email] should be passed without checks, because contains uncheckable addresses
Apr 15 10:49:57 h123456 qmail: 1145090997.859931 new msg 7242989
Apr 15 10:49:57 h123456 qmail: 1145090997.860067 info msg 7242989: bytes 1406 from <[email protected]_isp.net> qp 10213 uid 10009
Apr 15 10:49:58 h123456 qmail: 1145090998.015614 starting delivery 667: msg 7242989 to local [email][email protected][/email]
Apr 15 10:49:58 h123456 qmail: 1145090998.015764 status: local 1/10 remote 0/20
Apr 15 10:49:58 h123456 qmail: 1145090998.018504 delivery 667: failure: This_address_no_longer_accepts_mail./
Apr 15 10:49:58 h123456 qmail: 1145090998.018781 status: local 0/10 remote 0/20
Apr 15 10:49:58 h123456 qmail-queue: dwlib[10216]: mail: all addreses are uncheckable - need to skip scanning (by deny mode)
Apr 15 10:49:58 h123456 qmail-queue: dwlib[10216]: scan: the message(drweb.tmp.O153x8) sent by  to [email][email protected][/email]er_isp.net should be passed without checks, because contains uncheckable addresses
Apr 15 10:49:58 h123456 qmail: 1145090998.268687 bounce msg 7242989 qp 10216
Apr 15 10:49:58 h123456 qmail: 1145090998.268733 end msg 7242989
Apr 15 10:49:58 h123456 qmail: 1145090998.269758 new msg 7243052
Apr 15 10:49:58 h123456 qmail: 1145090998.269878 info msg 7243052: bytes 2002 from <> qp 10217 uid 2522
Apr 15 10:49:58 h123456 qmail: 1145090998.421461 starting delivery 668: msg 7243052 to remote [email][email protected][/email]er_isp.net
Apr 15 10:49:58 h123456 qmail: 1145090998.421607 status: local 0/10 remote 1/20
Apr 15 10:49:58 h123456 qmail: 1145090998.425749 delivery 668: failure: Sorry._Although_I'm_listed_as_a_best-preference_MX_or_A_for_that_host,/it_isn't_in_my_control/locals_file,_so_I_don't_treat_it_as_local._(#5.4.6)/
Apr 15 10:49:58 h123456 qmail: 1145090998.426050 status: local 0/10 remote 0/20
Apr 15 10:49:58 h123456 qmail-queue: dwlib[10219]: mail: all addreses are uncheckable - need to skip scanning (by deny mode)
Apr 15 10:49:58 h123456 qmail-queue: dwlib[10219]: scan: the message(drweb.tmp.5ttwVE) sent by #@[] to [email][email protected][/email]er_isp.net should be passed without checks, because contains uncheckable addresses
Apr 15 10:49:58 h123456 qmail: 1145090998.673820 bounce msg 7243052 qp 10219
Apr 15 10:49:58 h123456 qmail: 1145090998.673865 end msg 7243052
Apr 15 10:49:58 h123456 qmail: 1145090998.674372 new msg 7243050
Apr 15 10:49:58 h123456 qmail: 1145090998.674445 info msg 7243050: bytes 2616 from <#@[]> qp 10220 uid 2522
Apr 15 10:49:58 h123456 qmail: 1145090998.833316 starting delivery 669: msg 7243050 to remote [email][email protected][/email]er_isp.net
Apr 15 10:49:58 h123456 qmail: 1145090998.833419 status: local 0/10 remote 1/20
Apr 15 10:49:58 h123456 qmail: 1145090998.838210 delivery 669: failure: Sorry._Although_I'm_listed_as_a_best-preference_MX_or_A_for_that_host,/it_isn't_in_my_control/locals_file,_so_I_don't_treat_it_as_local._(#5.4.6)/
Apr 15 10:49:58 h123456 qmail: 1145090998.838485 status: local 0/10 remote 0/20
Apr 15 10:49:58 h123456 qmail: 1145090998.838586 triple bounce: discarding bounce/7243050
Apr 15 10:49:58 h123456 qmail: 1145090998.838682 end msg 7243050

This is my Perl:
PHP:
#!/usr/bin/perl -w

use strict;
use CGI::Carp 'fatalsToBrowser';

print "Content-type: text/plain\n\n";

# Pfad zum SENDMAIL-Programm Ihres Servers.
my $sendmail = '/usr/sbin/sendmail';

# Empfaenger-Adresse.
my $recipient = 'Firstname <[email protected]>';
#Format: 'Name als Text <[email protected]>';

# Betreff der eMail.
my $subject = 'Mail Test';

# von wem kommt der Autoresponder
my $absender=$ENV{HTTP_HOST}.' <working_mailbox@my_plesk.de>';
#Format: 'Name als Text <[email protected]>';

open(MAIL, "|$sendmail -t") or die "FEHLER $sendmail: $!\n";
print MAIL "To: $recipient\n";
print MAIL "From:$absender\n";
print MAIL "Subject: $subject\n\n";
print MAIL "Hallo Welt!\n";
foreach(keys %ENV){
	print MAIL '$ENV{'.$_."}=>'".$ENV{$_}."'\n";
}

close(MAIL) or die "FEHLER Mail $sendmail: $!\n";

print "Mail wurde\n".
      "von Host '$ENV{HTTP_HOST}'\n".
      "an '$recipient'\n".
      "von'$absender'\n".
      "via '$sendmail' geschickt.";

exit;

That returns no errors.

I found this, sorry, its german:
http://hosteurope.de/faq/index.php?cpid=11073

Short translation:
In PHP you need a param "-f" with an email adress which is working in your PLESK.
e.g.
mail ($to, $subject, $message, $headers, "-f [email protected]");

At my server that returns an error, fifth param not allowed- something like that.

I really need your help!!!

Thx!
 
can you explain that a bit, please?

Funny is, with web.de, something like gmx, I receive the mails from my perl program.

We test a lot, some adresses get mail, some not.
 
I'm also having problem with the PHP mail() function.

Its sometime can sent, sometime can't and return the following error:

PHP Warning: mail(): Could not execute mail delivery program '/usr/sbin/sendmail -t -i'

The permission of that sendmail link is:

0 lrwxrwxrwx 1 root root 23 Oct 20 2005 /usr/sbin/sendmail -> /var/qmail/bin/sendmail

and permission for /var/qmail/bin/sendmail is:

12 -r-xr-xr-x 1 root qmail 9640 Aug 24 2005 /var/qmail/bin/sendmai

My /var/qmail/control/me file is correct, as it can sent out sometime.

Other servers which also with Plesk are alright. Only this particular server having the problem. Anyone know what could be the problem? Is that the setting or permission?

Thanks in advance

Wonski
 
I'm having issues like this as well.

Here is tail of log:
Code:
Sep 12 12:04:11 localhost qmail: 1158087851.031464 new msg 116136755
Sep 12 12:04:11 localhost qmail: 1158087851.031570 info msg 116136755: bytes 350 from <[email protected]> qp 11867 uid 48
Sep 12 12:04:11 localhost qmail: 1158087851.057471 starting delivery 17: msg 116136755 to local [email][email protected][/email]
Sep 12 12:04:11 localhost qmail: 1158087851.057534 status: local 1/10 remote 0/20
Sep 12 12:04:11 localhost qmail: 1158087851.066080 delivery 17: failure: This_address_no_longer_accepts_mail./
Sep 12 12:04:11 localhost qmail: 1158087851.066958 status: local 0/10 remote 0/20
Sep 12 12:04:11 localhost qmail: 1158087851.176661 bounce msg 116136755 qp 11871
Sep 12 12:04:11 localhost qmail: 1158087851.176735 end msg 116136755
Sep 12 12:04:11 localhost qmail: 1158087851.177651 new msg 116136758
Sep 12 12:04:11 localhost qmail: 1158087851.178011 info msg 116136758: bytes 906 from <> qp 11871 uid 2522
Sep 12 12:04:11 localhost qmail: 1158087851.181655 starting delivery 18: msg 116136758 to remote [email][email protected][/email]
Sep 12 12:04:11 localhost qmail: 1158087851.181725 status: local 0/10 remote 1/20
Sep 12 12:04:11 localhost qmail: 1158087851.188048 delivery 18: failure: Sorry._Although_I'm_listed_as_a_best-preference_MX_or_A_for_that_host,/it_isn't_in_my_control/locals_file,_so_I_don't_treat_it_as_local._(#5.4.6)/
Sep 12 12:04:11 localhost qmail: 1158087851.188119 status: local 0/10 remote 0/20
Sep 12 12:04:11 localhost qmail: 1158087851.199638 bounce msg 116136758 qp 11873
Sep 12 12:04:11 localhost qmail: 1158087851.199700 end msg 116136758
Sep 12 12:04:11 localhost qmail: 1158087851.200582 new msg 116136756
Sep 12 12:04:11 localhost qmail: 1158087851.200636 info msg 116136756: bytes 1480 from <#@[]> qp 11873 uid 2522
Sep 12 12:04:11 localhost qmail: 1158087851.204661 starting delivery 19: msg 116136756 to remote [email][email protected][/email]
Sep 12 12:04:11 localhost qmail: 1158087851.204711 status: local 0/10 remote 1/20
Sep 12 12:04:11 localhost qmail: 1158087851.210182 delivery 19: failure: Sorry._Although_I'm_listed_as_a_best-preference_MX_or_A_for_that_host,/it_isn't_in_my_control/locals_file,_so_I_don't_treat_it_as_local._(#5.4.6)/
Sep 12 12:04:11 localhost qmail: 1158087851.211436 status: local 0/10 remote 0/20
Sep 12 12:04:11 localhost qmail: 1158087851.211480 triple bounce: discarding bounce/116136756
Sep 12 12:04:11 localhost qmail: 1158087851.211523 end msg 116136756

emails will go to host like gmail, but not others. I set the me file; I use the test php form above and get mail sent for all emails I try. Only receive in a gmail type account though.

Any more ideas?
 
This worked for me:

check out mta here:

/usr/sbin/alternatives --display mta

to chose from available MTA alternatives do:

alternatives --config mta

There are 3 programs which provide 'mta'.

Selection Command
-----------------------------------------------
+ 1 /usr/sbin/sendmail.sendmail
* 2 /var/qmail/bin/sendmail
3 /usr/sbin/sendmail.postfix

selecting option 1 of 3 (default was option 2) fixed the problem for me.

Good Luck, hope this helps

zch
 
I'm having exactly the same problem...
Sadly I can't find the file you are refering to. I tried to find them through the file manager and through the ftp but without success.
Could anyone help me please?

Thanks
 
Back
Top