Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-30-2012, 10:35 AM   PM User | #1
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
emails not sending from CentOS 5.6 VM on Win7 via PHP

I am experiencing an issue where my CentOS 5.6 (Final) VM running on Windows 7 has stopped sending emails from my PHP code.

I'm confident this isn't a coding issue as I have the exact same code running in my office and emails send correctly from there, hence why I believe this to be a networking/configuration issue.

In my /etc/hosts/ file on my VM I have the following:

Code:
127.0.0.1 localhost.localdomain localhost
192.168.0.9 crmpicco.co.uk m.crmpicco.co.uk dev53.localdomain
When I run setup on my VM the DNS configuration is set to dev53.localdomain and my Primary DNS is 192.168.0.1.

In My /var/log/maillog files I see a lot of this sort of thing:

Code:
Nov 19 14:36:58 dev53 sendmail[21696]: qAJEawI7021696: from=<client.care@crmpicco.co.uk>, size=12858, class=0, nrcpts=1, msgid=<1353335817.9103820024efb30b451d006dc4ab3370@PHPMAILSERVER>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Nov 19 14:36:58 dev53 sendmail[21693]: qAJEawvd021693: to=newbie@fletcher.co.uk, ctladdr=client.care@crmpicco.co.uk (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=42681, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (qAJEawI7021696 Message accepted for delivery)
Nov 19 14:36:59 dev53 sendmail[21698]: qAJEawI7021696: to=<newbie@fletcher.co.uk>, delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=132858, relay=mailserver.fletcher.co.uk. [213.171.216.114], dsn=5.0.0, stat=Service unavailable
Is this likely to be a configuration issue?
crmpicco is offline   Reply With Quote
Old 11-30-2012, 12:16 PM   PM User | #2
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,505
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Given the semi complex nature of your setup and the fact you've not told us if you're using sendmail, fakesendmail, SMTP etc, there isn't going to be a great deal that we can do to advise you here.

As for the coding issue, while the code may work perfectly well on one machine, it's quite possible for it not to run on another. Just silly things like one machine having a slightly different PHP version can cause problems. I worked on a project a while back that I developed using PHP 5.3 and when I uiploaded it to the server (running 5.0) all hell broke loose. Nothing really worked, the use of the date() function seemed to be knackered and I spent many hours debugging it to keep my rather worried client happy (and traced it down to something really silly to do with a 5.0 and 5.3 difference using the date() function iirc).

Now, your log shows one email accepted for delivery and another saying the service is unavailable. That could indicate thatr you're having spam problems outside of your network - EG your IP is blocked, maybe even port 25 or worse, your IP is on a spam blacklist. There are many reasons. I think you're going to have to run a local mail server and see if you can at least send mail @localhost just to be sure that it is actually sending and then try sending to a mailserver on another machine (or even your VM host) before trying to send mail out of the network again. It's a gradual process of trial and error to determine where the fault in the process is.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 11-30-2012, 12:32 PM   PM User | #3
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
Quote:
Originally Posted by tangoforce View Post
Given the semi complex nature of your setup and the fact you've not told us if you're using sendmail, fakesendmail, SMTP etc, there isn't going to be a great deal that we can do to advise you here.

As for the coding issue, while the code may work perfectly well on one machine, it's quite possible for it not to run on another. Just silly things like one machine having a slightly different PHP version can cause problems. I worked on a project a while back that I developed using PHP 5.3 and when I uiploaded it to the server (running 5.0) all hell broke loose. Nothing really worked, the use of the date() function seemed to be knackered and I spent many hours debugging it to keep my rather worried client happy (and traced it down to something really silly to do with a 5.0 and 5.3 difference using the date() function iirc).

Now, your log shows one email accepted for delivery and another saying the service is unavailable. That could indicate thatr you're having spam problems outside of your network - EG your IP is blocked, maybe even port 25 or worse, your IP is on a spam blacklist. There are many reasons. I think you're going to have to run a local mail server and see if you can at least send mail @localhost just to be sure that it is actually sending and then try sending to a mailserver on another machine (or even your VM host) before trying to send mail out of the network again. It's a gradual process of trial and error to determine where the fault in the process is.
I'm using sendmail on my VM. Really, considering it's only a development environment I only need to send an email to myself.

When you say I could be having SPAM problems - can you elaborate? How could I determine this?
crmpicco is offline   Reply With Quote
Old 11-30-2012, 01:31 PM   PM User | #4
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,505
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
I have elaborated. You need to use google a bit more and check out IP blacklists, port 25 testing etc. As I've said, you need to look at the logic flow here and work out which part of the chain is failing. You're a Zend Certified Engineer, you should know this!

Sendmail is an SMTP client. That means it will connect to a SMTP Server at the recipients domain and pass the email straight to it (in theory) OR it will be configured to use an SMTP relay. Now, it may be that your SMTP is not working because your ISP has blocked port 25 (maybe they've had a report of you spamming?). It maybe that your sendmail config has changed (eg, rolled back with a system restore) or maybe your IP is on a spammers IP blacklist. Again there is no definite answer I can give you because its a process of elimination.

You say you only need to send mail to yourself locally yet your log shows you're clearly trying to send to fletcher.co.uk which is not in your hosts file (so its out there on the web) so I'm not quite sure that I follow when you say you only need to send to yourself?
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Reply

Bookmarks

Tags
centos, email, linux, php, virtual machine

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 09:36 AM.


Advertisement
Log in to turn off these ads.