Solved

IE 7 "Operation Aborted" when calling PHP mail()

Posted on 2013-01-17
17
448 Views
Last Modified: 2013-01-17
Hi...

URGENT FIX REQUIRED!!

Made a lovely new website - super.  It's for a university and some of their computers are still running IE7 (and are locked so can't be updated).  Site goes live tomorrow so need solution in next 4 hours!!!1 no pressure then.

In IE7 all calls to mail() via PHP cause the browser to popup a message and stop loading page - however the email IS sent!!

message:
"Internet Explorer cannot open the Internet Site
http://   ...

Operation Aborted"

PLEASE HELP SOON!!!

Cris.
0
Comment
Question by:CrisThompsonUK
  • 10
  • 3
  • 3
  • +1
17 Comments
 

Author Comment

by:CrisThompsonUK
ID: 38786854
tried moving all javascript to body rather than head, but no good.

and it's not a direft javascrips call that's doing it, it's php mail()!!
0
 
LVL 30

Expert Comment

by:IanTh
ID: 38786855
why are you still using ie7 the latest is ie9 and M$ is silently updating ie or by browser choice
0
 

Author Comment

by:CrisThompsonUK
ID: 38786861
Come on experts....

Microsoft say: http://support.microsoft.com/kb/927917#more_information

"This problem occurs because a child container HTML element contains script that tries to modify the parent container element of the child container. The script tries to modify the parent container element by using either the innerHTML method or the appendChild method.

For example, this problem may occur if a DIV element is a child container in a BODY element, and a SCRIPT block in the DIV element tries to modify the BODY element that is a parent container for the DIV element. "

huh?
0
 

Author Comment

by:CrisThompsonUK
ID: 38786866
I tried swapping the php mail() for a PERL mail call - same problem...


Come on experts...
0
 

Author Comment

by:CrisThompsonUK
ID: 38786911
It's for a university and some of their computers are still running IE7 (and are locked so can't be updated).

not up to me.
0
 

Author Comment

by:CrisThompsonUK
ID: 38786929
tried adding  defer="defer" to my script defs...

no good - it's a php call!!

maybe a script email?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38787042
why are you still using ie7 the latest is ie9

wrong, it's IE10

check this page : http://php.net/manual/en/features.connection-handling.php
try the code, function of the second post
0
 
LVL 30

Expert Comment

by:IanTh
ID: 38787082
what is the pop up a security error ? like a path problem to php?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 34

Expert Comment

by:gr8gonzo
ID: 38787188
It's not php mail().

Server-side mail() commands  by themselves are not going to impact the browser. They don't output anything that would cause a browser to crash, so if IE7 is crashing because of it, then that probably means that the mail() is part of a condition, like:

if(mail("blah blah"))
{
    ... the code that is causing the error is probably here ...
}

Moving Javascript around the page won't change the final functionality of it in most cases.

What that message most likely indicates is that Javascript is basically wiping itself out. It's like a bulldozer trying to wreck a house by starting inside the living room and trying to break its way out, and everything demolishes upon itself.

That said, there's no way to be sure unless you provide the PHP, Javascript, and HTML.

Also based on your situation, I'd recommend you look into SDLC practices if you're going to be producing web sites for organizations. Learn to push things through the proper stages and you won't run into these bugs hours before go-live.
0
 

Author Comment

by:CrisThompsonUK
ID: 38787247
thanks gr8gonzo

but when I have :
if (!$old_browser)  {  mail($to, $subject, $message, $headers);};

The code runs fine without the errors on IE7, so is there something javascripty either side of the php mail()????

Can I use something completely different to send emails - like I said, already tried the PERL...

Cris.
0
 

Author Comment

by:CrisThompsonUK
ID: 38787278
code snippit:

                  $headers = 'From: infomine@domain.org.uk' . "\r\n" .
                        'Reply-To: infomine@domain.org.uk' . "\r\n" .
                        'X-Mailer: PHP/' . phpversion();
                  
                  echo "About to send email...";

                  mail($to, $subject, $message, $headers);
                  
                  echo "<br>Email Sent...";

I don't see the second echo...

Should I trap errors in the mail call?
0
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 500 total points
ID: 38787286
This might take a lot longer if we don't have all the code. Otherwise, I have to ask things like, "What is $old_browser and where is it defined?" and then wait for you to answer.

Does !$old_browser mean that the mail() isn't running when the browser is IE7?

You can also try this:

ob_start();
mail($to, $subject, $message, $headers);
file_put_contents("mail-output.txt",ob_get_clean());

Then run the code and look in the script's folder for mail-output.txt and see what it contains. I'd also suggest running Fiddler to see what is actually coming back. There really should never be any Javascript from the mail() command.

The only thing I can think of that could cause something like that would be if someone messed with the error outputting so that if mail() was throwing an error, there was some formatted message that messed with Javascript.

It would REALLY help to see the actual content sent back from the web server when the error happens, though, so install Fiddler2 and run it:

http://www.fiddler2.com/fiddler2/
0
 

Author Comment

by:CrisThompsonUK
ID: 38787742
I'm not trying to be secretive - it's a complex process to get the page where the error happens...

I set $old_browser thus:

// is the user using IE 6 or 7?
$user_agent = $_SERVER['HTTP_USER_AGENT'];

if (preg_match('/MSIE 7/i', $user_agent)) {
   $old_browser = true;
}
if (preg_match('/MSIE 6/i', $user_agent)) {
   $old_browser = true;
}

so I could tempoarily skip the mail() function so test the rest of the code.

----------------------------

Tried writing to mail-output.txt, but it's contents is blank!!!

----------------------------

But, getting a bit closer...

I removed all the scripts and then added them in back one by one until the 'conflict' with php mail re-occured...

My index.php is attached, there's lots of PHP before the HTML, but line 437 is doing it:
 <!--[if lte IE 7]><link rel="stylesheet" href="style.ie7.css" media="screen" /><![endif]-->

My template was created using Artisteer, and this addon style sheet was auto generated.

But - it doesn't matter what the contents of the file is, just the inclusion of it.  When the file is empty I still get the error.  If I remove the statement altogether, the error goes away, but the CSS is bust!!!

What do you make of that?
0
 

Author Comment

by:CrisThompsonUK
ID: 38787818
Right... Got it!!!!!

Sorry, it was the content of style.ie7.css.

The first line is

   zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).className="cleared");

and wirthout it the mail error goes away.

Thanks for all your ideas and really great resources.

When I have a bit of time (and completed the tax return) I will go over them.  If you have any further insight, that would be gratefully received.

Cris.
0
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 38787916
Unless you need that line, there's probably not much reason for keeping it. A lot of auto-generated CSS and HTML can be included for no reason. Generator programs don't usually bother trying to "detect" whether you're using something - it just includes it anyway.

I'm not sure why including mail() would trigger that CSS rule. Since the output of that command was blank (as expected), there's no reason it should trigger the CSS, which means that there's probably something else. I know it's a complex lead-up, but without seeing code, there's no possibility for anyone to check for related issues.

The fact that including mail() seems to trigger the CSS rule seems to point to some other piece of unrelated code that is ACTUALLY the real culprit.

It's sort of like pulling a wire out of a car engine and giving it to a mechanic and saying that it is causing the engine not to start. The wire itself looks fine, but without seeing the rest of the engine, there's no way to know what kind of other interactions could be causing it.

All I can tell you is that it's definitely not mail() that is triggering the CSS rule. If you still need help later on when you go back and review the code, open another question on here and include the full code.
0
 

Author Comment

by:CrisThompsonUK
ID: 38787968
Thanks for your time.

Cris.
0
 
LVL 30

Expert Comment

by:IanTh
ID: 38787987
in future don't use artiseer for a full page it will drive you mad trying to understand the div structure you can though  say use artiseer for the header and footer delete all the content between and do you own div structure
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I had to do a bit of research to find the answer to this question so I thought I'd share my results.  Due to our outdated mainframe systems, we need to downgrade IE9 to IE8 in order to stay compatible.  We also needed to downgrade Java.  In order to…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

13 Experts available now in Live!

Get 1:1 Help Now