Jump to content

Getting phpmail to function


VirusZero
 Share

Recommended Posts

According to the server

 

Using "hostname" it's server.endlessfight.net

Using "dnsdomainname" it's localdomain

Using "hostname -f" it's localhost.localdomain

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

Try commenting out the myhostname line.

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

I've commented out the $myhostname in main.cf (saved and rebooted postfix). I tried sending an email and here's the error I got this time:

 

Mar 19 19:15:41 server sendmail[24320]: u2JNFfPw024320: from=apache, size=147, class=0, nrcpts=1, msgid=<201603192315.u2JNFfPw024320@localhost.localdomain>, relay=apache@localhost

Mar 19 19:15:41 server postfix/smtpd[24321]: connect from localhost.localdomain[127.0.0.1]

Mar 19 19:15:41 server postfix/smtpd[24321]: NOQUEUE: reject: RCPT from localhost.localdomain[127.0.0.1]: 454 4.7.1 <endlessfightforum@gmail>: Relay access denied; from=<apache@localhost.localdomain> to=<endlessfightforum@gmail> proto=ESMTP helo=<localhost.localdomain>

Mar 19 19:15:41 server sendmail[24320]: u2JNFfPw024320: to=endlessfightforum@gmail, ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30147, relay=[127.0.0.1] [127.0.0.1], dsn=4.7.1, stat=Deferred: 454 4.7.1 <endlessfightforum@gmail>: Relay access denied


Mar 19 19:15:41 server postfix/smtpd[24321]: disconnect from localhost.localdomain[127.0.0.1]

 

Would this have anything to do with editing the hostfile?  I mean 

echo $(hostname).$(awk -F' = ' '/^mydomain/{print$2}' /etc/postfix/main.cf)

 

thinks that the domain is "server.endlessfight.net.endlessfight.net"

 

Also Centos pulls the hostname from /etc/sysconfig/network

And in that file it has:

HOSTNAME="server.endlessfight.net"


My /etc/hosts looks like

127.0.0.1 localhost.localdomain localhost localhost4.localdomain4 localhost4 autoreply.server.endlessfight.net server.endlessfight.net
# Auto-generated hostname. Please do not remove this comment.
168.235.82.95 server.endlessfight.net  server
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

 

 

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

It could be but technically since it is using itself as the relay it SHOULD technically be going through because it is itself. Example files for this are hard to find. Try adding:

localhost.endlessfight.net

Into your hosts file. I'm not sure if you should replace the localhost.localdomain or not.

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Apologies for taking so long to get back to this (been busy as of late). 

 

 I added localhost.endlessfight.net to 127.0.0.1 entry then restarted the network ( using "/etc/init.d/network restart" ). I then tried sending a test email, but var/log/maillog still shows that same error like in my previous post.

 

 

  • I read this! 1
"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

*punches phpmail* This is why I use Exim. Alright. I've found this a few times but didn't want to try it. Lets try it and if it works then we'll know what to tweak and move forward from. Remove this from your file:

reject_unauth_destination,

 

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

I removed that line and reloaded the configuration settings... Doesn't seem to have helped anything. Here's what my var/log/maillog shows:

 

server sendmail[15170]: u35HGlt6015170: from=apache, size=147, class=0, nrcpts=1, msgid=<201604051716.u35HGlt6015170@localhost.localdomain>, relay=apache@localhost

 server postfix/smtpd[15171]: fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit

 server postfix/master[15163]: warning: process /usr/libexec/postfix/smtpd pid 15171 exit status 1

server postfix/master[15163]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

 

Before the roundcube email at least worked, but now it is broken too. After clicking send the page just sits there, icon spinning to show communicating with the server but no response back. PHPmail does the same thing as roundcube.
 

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

Everything I've read or found all states that it's a configuration error in the actual file or on the server itself. Basically (from what it appears) it's actually rejecting itself.

 

(pounds head on keyboard)

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

I have no idea either, most of the things I've tried haven't worked either (most of them have been about properly setting up main.cf and the results of that are in a previous post here).  By all documentation I've seen the main.cf should be configured correctly. 

But the server shouldn't be auto-rejecting itself, it'd have no reason to. 

 

For completeness sake, here are all the steps I've taken to actually set the server up:

1- Purchase the hosting and perform initial set up (set OS, update DNS, etc...)

2- Install zPanel (using these instructions).

3- Install Nano (using "yum install nano") for a text editor. 

4- Update from PHP 5.3 to 5.5.29 (following these instructions).

5- Install Ajax Explorer (using these instructions, note that it's a pdf because the original site has since expired. But I saved a back up copy of the instructions, just in case.) 

6- Install CSF using these instructions:

7- Login to zPanel and set domain, create a database, upload MyBB, upload database, fix MyBB's config file so it can find the right database and use proper access details. Then create a subdomain, upload dokuwiki files, edit dokuwiki bridge details to use proper database credentials (like I did with MyBB), test to ensure dokuwiki and MyBB are bridged properly.
8- Set up SMTP email using this topic to help (mainly for the mx record).

9- Remove CSF (using "cd /etc/csf/" then "sh uninstall.sh")

10- Set up IPtables according to this. (Which I posted about in the opening.)

Edited by VirusZero
"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

Are you, perchance, using suhosin? Or whatever it's called. It's a firewall.

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

I didn't think it was bundled with anything after PHP 5.2.  I tried checking with:

php -i | grep -i suhosin

php -m | grep suhosin

 

And it doesn't return anything. So I don't think it's even installed.

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

I mean everything looks fine at this point the top three causes (in order of relevance) are:

  1. Firewall/blocking program/Permissions
  2. DNS
  3. Configuration issue

Those are really the only things I can think of. I mean Linux doesn't give "Permission denied" errors all willy nilly like.

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Hmm, might as well rule things out then...

 

I only have IPtables for a firewall and it's settings (iptables -S) are:

-P INPUT DROP
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 465 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 110 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 995 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 143 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 993 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 20 -j ACCEPT

 

Spoiler

The iptables -L version

 


Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE
DROP       tcp  --  anywhere             anywhere            tcp flags:!FIN,SYN,RST,ACK/SYN state NEW
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,SYN,RST,PSH,ACK,URG
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:smtp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:urd
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:pop3
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:pop3s
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:imap
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:imaps
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ftp

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp spt:ftp-data

 

 

 

My DNS info seems ok (according to intodns)

Spoiler

The IPs are all set to 168.235.82.95

MX record for mail.endlessfight.net

PTR record is set, though it's set for server.endlessfight.net...

 

And for configuration, it seems like most settings are set properly and shouldn't be giving any issues. 

 

I have a feeling though that I'm overlooking something stupidly obvious and that's what's giving me so much trouble. But I can't for the life of me figure out what.

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • 3 weeks later...

Just for a heads up about this issue, I've gotten this fixed... Sort of. 

I was never able to figure out just why it wasn't working exactly. But the problem has been resolved because I've reinstalled the OS and installed cPanel instead.  All emails now send exactly as they should.

  • I read this! 1
"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

So you're using Exim now? (default with cPanel).

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.