Solved

Email failure

Posted on 2013-12-09
27
220 Views
Last Modified: 2013-12-13
Hello,

I have been struggling with this for quite a while; some of my previous questions have dealt with parts of this.

See attached updt_testt.php. Note the use of class.phpmailer.php on line 57 (also attached). Note lines 65 - 66, as follows:

$eaddr3 = "kneff@lawnsprinklerservices.com";
$mail->AddAddress($eaddr3);

Note the other email addresses (specifically aveatch@lawnsprinklerservices.com and richardkorts@gmail.com). When this is run on the server, emails are sent to all EXCEPT kneff@lawnsprinklerservices.com.

See attached thank_you.php. Note the use of class.phpmailer.php on line 51 (also attached). Note lines 58 - 59 as follows:

$addr3 = "kneff@lawnsprinklerservices.com";
$mail->AddAddress($addr3);

When this one is run, emails are received by all.

Why does it work with one & not the other for one specific email address?

Thanks
updt-testt.php
thank-you.php
class.phpmailer.php
0
Comment
Question by:Richard Korts
  • 12
  • 9
  • 6
27 Comments
 
LVL 19

Expert Comment

by:xterm
ID: 39706984
What operating system is the server running?
0
 

Author Comment

by:Richard Korts
ID: 39707091
To xterm,

I'm not sure, it's a commercial web server, I'm assuming Linux.

Thanks
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39707112
Are you getting a NDR / bounce message?  Which web site are you sending the email from?  And lastly, what message rules and spam filtering are setup on the email client for "kneff@lawnsprinklerservices.com"?  If they have a rule or spam filter that id's your email or server as spam, you won't be able to get thru.  I know that SpamAssassin grey-listing will block the Godaddy mail servers.  I had to turn that off in my email setup on my web site.
0
 
LVL 19

Expert Comment

by:xterm
ID: 39707118
If it's Linux, then you should be able to look at /var/log/maillog at the time you submit the web form, and you will see what happens with the attempt.

You can run the command "tail -f /var/log/maillog" and it will show you the last few lines, and continue to scroll when anything new gets added to it.  Hit CTRL-C to cancel out of it.  This should tell you if it's even attempting the mail, and any errors it encounters.

You can also use the command "mailq" which will tell you which mails are stuck in queue waiting to go out.  If your messages are in there, you will see the error that caused the failure in the output of the mailq command.
0
 

Author Comment

by:Richard Korts
ID: 39707129
DaveBaldwin,

The message is just not received by the indicated email address.

It is sent on lawnsprinklerservices.biz.

Until a few days ago, the "anti-spam" was turned on for the address failing, it was NOT turned on for Aveatch@lawnsprinklerservices.com & his are (were) coming through. So, of course, I thought it was that.

I changed that to turn anti-spam off; same result. I did a test this AM AFTER I made the change & it failed.
0
 
LVL 19

Expert Comment

by:xterm
ID: 39707138
The mail exchanger servers for lawnsprinklerservices.com|biz are mx00.1and1.com and mx01.1and1.com.  You should be able to ask your host to look at their mail system logs to determine if the mail was received, rejected, or quarantined.

I still think you should check on your web server first to see if the messages are going out though first, since that is the natural order of diagnostics.
0
 

Author Comment

by:Richard Korts
ID: 39707425
xterm

I don't think we are communicating.

The mail is sent, the mail class reports it as so & it IS RECEIVED by at least two of the recipients.

The issue is it is NOT being received by ONE of the recipients, and only in ONE case, not the other which is programmed identically.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39707444
Those files are not nearly the same.  The 'thank-you.php' is for WHA, not lawnsprinklerservices.biz.
0
 

Author Comment

by:Richard Korts
ID: 39707474
DaveBaldwin

Sorry, I sent the wrong one. See attached.

Thanks
thank-you.php
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39707493
That one has the "donotreply@LSS.com" 'From:' address.  Is that the one with the problem?
0
 

Author Comment

by:Richard Korts
ID: 39707507
I just looked at the code. From what I see lines 54 - 64 look like this. But this is the one that WORKS.

      $mail             = new PHPMailer();
      $addr1 = "lawnsprinklerservice@hotmail.com";
      $mail->AddAddress($addr1);
      $addr2 = "aveatch@lawnsprinklerservices.com";
      $mail->AddAddress($addr2);
      $addr3 = "kneff@lawnsprinklerservices.com";
      $mail->AddAddress($addr3);
      $cc = "richardkorts@gmail.com";
      $mail->AddCC($cc);
      $mail->Subject = "On-Line Invoice Payment";
      $mail->SetFrom('service@lawnsprinklerservices.com');
0
 
LVL 19

Expert Comment

by:xterm
ID: 39707518
I don't think we are communicating.

The mail is sent, the mail class reports it as so & it IS RECEIVED by at least two of the recipients.

The issue is it is NOT being received by ONE of the recipients, and only in ONE case, not the other which is programmed identically.


I understand you perfectly  - I'm telling you (as an ISP system administrator of a very large mail system) how to determine whether the email is leaving your web server or not, and/or if after it's left, it's been received by the remote server.  The fact that 2 out of 3 recipients actually gets their copy of the mail indicates to me that there is no reason to suspect your code, but instead the SMTP process after your form is submitted.

I'm not understanding your hesitation to run a few simple commands - do you not have Unix access to your web server?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39707532
Richard, there are two more sections in that code that use the PHP mail() command.  Can you send any email with any client to the address that is failing?

@xterm, I think it's likely that he is on shared hosting with the mx00.1and1.com mail server.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Richard Korts
ID: 39709014
To xterm, what Dave Baldwin says is exactly right. It is 1 & 1 shared host. I might be able to get to those logs, I can't remember how well 1 & 1 cooperates on that kind of request; usually, not too well.

Dave, I can manually send her an email using my gmail.

The php program thank_you.php sends emails to the company admin (she is one) when a customer pays an invoice online. She gets those. I had forgotten that there was a 2nd email sent (in thank_you) to the customer; since it works, I did not change it, although I am gradually changing ALL my email generations to class.phpmailer.php; I believe that was partially or exclusively your recommendation a while back.

The ONLY ones she does not get (of the automated ones) is the one sent upon the entry of a new customer (uptd_testt.php). I am trying to determine what is different about the email sending part between thank_you (works) and uptd_testt.php (does NOT work, but ONLY for that ONE email address).

Thanks
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 250 total points
ID: 39709057
Well, it's a lot harder to troubleshoot without simply looking at what happened on the server, but since you say that is difficult to obtain, let's analyze it from a code standpoint:

1)  thank_you.php
- Uses the PHP built-in mail() functionality to send
- Sets a From address of WHA@whasocal.org
- Works as it should

2) uptd_testt.php
- Uses class.phpmailer to send
- Sets a From address of service@lawnsprinklerservices.com
- Works as it should for 2 out of 3 recipients

The question I guess is, if you substitute the To: address from uptd_testt.php that isn't receiving the mail (kneff@lawnsprinklerservices.com) into thank_you.php, does it get the email?

So change $tostr = "richard@rkassociates.com"; temporarily to "$tostr = "kneff@lawnsprinklerservices.com"; and then submit the form and see if the message is received.

Is that doable?
0
 

Author Comment

by:Richard Korts
ID: 39709200
To xterm

The version of thank_you.php originally attached to this question was the WRONG one; the correct one is attached.

The emails are ALL properly sent from thank_you.php. It is the other one (updt_testt.php) that delivers all EXCEPT to kneff@lawnsprinklerservices.com.

Thanks
thank-you.php
0
 
LVL 19

Expert Comment

by:xterm
ID: 39709214
Gotcha, looking it over.
0
 
LVL 19

Expert Comment

by:xterm
ID: 39711772
Since you don't have access to the mail system logs, the best I can suggest to you is in updt_testt.php, shuffle the recipient order around to see if that changes who gets the emails.

So maybe replace:
         
                $eaddr1 = "lawnsprinklerservice@hotmail.com";
                $mail->AddAddress($eaddr1);
                $eaddr2 = "aveatch@lawnsprinklerservices.com";
                $mail->AddAddress($eaddr2);
                $eaddr3 = "kneff@lawnsprinklerservices.com";
                $mail->AddAddress($eaddr3);

Open in new window

with:
               
                $eaddr0 = "kneff@lawnsprinklerservices.com";
                $mail->AddAddress($eaddr0);
                $eaddr1 = "lawnsprinklerservice@hotmail.com";
                $mail->AddAddress($eaddr1);
                $eaddr2 = "aveatch@lawnsprinklerservices.com";
                $mail->AddAddress($eaddr2);

Open in new window

And resubmit, and see which recipients receive it.
0
 

Author Comment

by:Richard Korts
ID: 39712197
xterm,

Thanks, I tried that & the result is the same (same people get delivery, the one that hasn't all along does not get it reshuffled either.

Thanks

Any other ideas? Anyone?

I know if I change hosts I can make it work (this ISN'T Rocket Science) but my client has already advance paid for hosting so he doesn't want to change.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39712237
I know if I change hosts I can make it work
How do you know that?  While you're right that it isn't Rocket Science, email is a Mess still.  Many things are not predictable because you can't see what is blocking your email from going thru.  You can not Force someone to receive an email from you.
0
 

Author Comment

by:Richard Korts
ID: 39712244
DaveBaldwin

Alright, I don't KNOW that. But I STRONGLY suspect it.

Do you think it could be a timing thing?

Like if I pause 10 seconds BEFORE sending the email that does NOT go through, then send it by itself?

Thanks
0
 
LVL 19

Expert Comment

by:xterm
ID: 39712258
I think at this point you need to break down and ask your host to check outbound mail logs and/or mail queues on the web server sending the mail - this is something simple, and all you lack to solve it is visibility.
0
 

Author Comment

by:Richard Korts
ID: 39712281
to xterm

I will try that; based on my past experience with them, that will be difficult.

Thanks
0
 
LVL 19

Expert Comment

by:xterm
ID: 39712308
While you're waiting for an answer on that, just for grins can you do the following change and see if anything different happens?

After these lines:

                echo "body = " . $body . "<br>";
                $mail->MsgHTML($body);

Add this one:

                mail("$eaddr3", "New Instant Customer - test 7","$body","From: service@lawnsprinklerservices.com\r\n","-f"."service@lawnsprinklerservices.com");

And see if it goes through - basically it bypasses the phpmailer class and just does a manual send with all of the same info as the other one.
0
 

Author Comment

by:Richard Korts
ID: 39712509
To all,

I may have a clue. The customer told me that the email lawnsprinklerservice@hotmail.com forwards to kneff@lawnsprinklerservices.com.

So why we have to send to both is ???

So it MIGHT be that 1 & 1 is set up to reject what appears to be two identical emails in a VERY short period of time; sort of a start of an onslaught. Easy to test, I will.

Thanks
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 39712561
Well, I consider 1and1 to be a bad host.  But every sign so far is that either 1. the recipient is blocking the email or 2. you're getting bad info from the client.  According to your comment above, kneff@lawnsprinklerservices.com should be getting two emails each time.
0
 

Author Closing Comment

by:Richard Korts
ID: 39717643
The problem is NOT solved; I am splitting the points based on the effort you both put it.

My customer said (basically) "stop wasting time on that, we will just forward her (kneff@lawnsprinklerservices.com) the one I get".

Rkorts
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today, security is a big concern in an organization to prevent sensitive data leakage. In Outlook you can secure your Outlook items (emails, calendars, contacts and other stuff) using various techniques like by marking item as private, or you can pu…
Pegasus Mail (http://www.pmail.com/) is a donation ware that is a collaboration of David Harris along with his team members. It is a desktop mail client that offers the option of configuring more than one mail account with single set up. It supports…
The purpose of this video is to demonstrate how to set up a Mailchimp campaign. This will include styling and adding elements to a newsletter/email. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchim…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now