473,415 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,415 software developers and data experts.

mail function generates 500 internal server error

Hey,

I had a hard disc problem last week on my server. I replaced the disc and
copied al the files to the new hard disc, everything works fine again except
some php scripts that are using the mail() function. When executing these
scripts I get this error:
"500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.

Please contact the server administrator, we*******@mydomain.com and inform
them of the time the error occurred, and anything you might have done that
may have caused the error.

More information about this error may be available in the server error log."
In my logs I find this:malformed header from script. Bad
header=/home/mydomain/dead.letter...: php-script

Does somebody know what the problem could be?

grt,

Lieven
May 12 '06 #1
11 12288
>I had a hard disc problem last week on my server. I replaced the disc and
copied al the files to the new hard disc, everything works fine again except
some php scripts that are using the mail() function. When executing these
scripts I get this error:
"500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.

Please contact the server administrator, we*******@mydomain.com and inform
them of the time the error occurred, and anything you might have done that
may have caused the error.

More information about this error may be available in the server error log."
In my logs I find this:malformed header from script. Bad
header=/home/mydomain/dead.letter...: php-script
The program invoked by the mail() function (often sendmail) is generating
an error message, which is messing up your output since the web server
thinks it is supposed to be a CGI header, but it isn't.

Temporary workaround: output some text
(e.g. <html><head><title>This is a title</title></head><body>\n")
*before* calling the mail function. You will see the error message
text in the output from your page. Then figure out what it means.
*SOMETHING* is wrong with the mail and it's saving it in a dead.letter
file because it can't deliver it.
Does somebody know what the problem could be?


Gordon L. Burditt
May 12 '06 #2
Temporary workaround: output some text
(e.g. <html><head><title>This is a title</title></head><body>\n")
*before* calling the mail function. You will see the error message
text in the output from your page. Then figure out what it means.
*SOMETHING* is wrong with the mail and it's saving it in a dead.letter
file because it can't deliver it.

I have tried this, but I'm still receiving this error. The online line I
have in my php file is the line with the mail function.

grt,

Lieven
May 15 '06 #3
>> Temporary workaround: output some text
(e.g. <html><head><title>This is a title</title></head><body>\n")
*before* calling the mail function. You will see the error message
text in the output from your page. Then figure out what it means.
*SOMETHING* is wrong with the mail and it's saving it in a dead.letter
file because it can't deliver it.

I have tried this, but I'm still receiving this error. The online line I
have in my php file is the line with the mail function.


When you see the error message, then click "view source" in your
browser and paste the exact text of the error message and everything
before it into a post.

Gordon L. Burditt
May 15 '06 #4
>
When you see the error message, then click "view source" in your
browser and paste the exact text of the error message and everything
before it into a post.

This is the source code, I replaced my domain with "mydomain":
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
we*******@mydomain.be and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr />
<address>Apache/2.0.50 (Fedora) Server at www.mydomain.be Port 80</address>
</body></html>
May 15 '06 #5
Lieven wrote:
When you see the error message, then click "view source" in your
browser and paste the exact text of the error message and everything
before it into a post.


This is the source code, I replaced my domain with "mydomain":
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
we*******@mydomain.be and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr />
<address>Apache/2.0.50 (Fedora) Server at www.mydomain.be Port 80</address>
</body></html>


Lieven,

Looks like your mail() function is aborting for some reason. I suspect it may
be taking one of the Apache processes with it.

Anything in your Apache log?

What MTA are you using, and is it running OK? I suspect this may be an in-house
system (since you talked about disk failure). Can you send mail from your email
program using the MTA on this system (not your ISP's)?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 16 '06 #6
Lieven,

Looks like your mail() function is aborting for some reason. I suspect it
may be taking one of the Apache processes with it.

Anything in your Apache log?

What MTA are you using, and is it running OK? I suspect this may be an
in-house system (since you talked about disk failure). Can you send mail
from your email program using the MTA on this system (not your ISP's)?

I'm using sendmail. This is a server that is running a hostingsapplication
(ensim). It uses sendmail to send emails. My emailclient uses this server as
outgoing server and this is working fine, I downloaded a php class that
makes it possible to send mail by specifying a smtp sever and when I use
'localhost' as smtp server this is working fine. If I lower the security
level of a domain (this is a setting in my hostingsapplication), the mail
functions works again, but it is really unsecure to do this for all my
customers.
The only error that I find was the one I mentioned earlier, the 'malformed
header from script...'. Thnaks for your help!!

grt,

Lieven
May 16 '06 #7
Lieven wrote:
Lieven,

Looks like your mail() function is aborting for some reason. I suspect it
may be taking one of the Apache processes with it.

Anything in your Apache log?

What MTA are you using, and is it running OK? I suspect this may be an
in-house system (since you talked about disk failure). Can you send mail
from your email program using the MTA on this system (not your ISP's)?


I'm using sendmail. This is a server that is running a hostingsapplication
(ensim). It uses sendmail to send emails. My emailclient uses this server as
outgoing server and this is working fine, I downloaded a php class that
makes it possible to send mail by specifying a smtp sever and when I use
'localhost' as smtp server this is working fine. If I lower the security
level of a domain (this is a setting in my hostingsapplication), the mail
functions works again, but it is really unsecure to do this for all my
customers.
The only error that I find was the one I mentioned earlier, the 'malformed
header from script...'. Thnaks for your help!!

grt,

Lieven


Lieven,

Did you try asking the authors of the PHP class? Not knowing what it does (or
even which class it is) makes it impossible to tell what's going on.

Does a simple mail() command work? That would be the place to start if you're
asking in this group.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 16 '06 #8

Lieven,

Did you try asking the authors of the PHP class? Not knowing what it does
(or even which class it is) makes it impossible to tell what's going on. This script is just the normal phpmailer
(http://phpmailer.sourceforge.net/), there you can specify that you want to
use smtp like this:
$mailman = new PHPMailer();

$mailman->IsSMTP();

Using this tool, sending mails from our php scripts works, but it is
impossible to ask all our customers to change their php scripts.
Does a simple mail() command work? That would be the place to start if
you're asking in this group.
No, that is the whole problem. The mail function doesn't work anymore. After
a hard disk crash I copied the whole corrupt hard disk to a new disk,
everything else is working perfectly afterworths except php scripts that are
using the mail() function are getting the internal server error. I didn't
change anything to my configuration files or didn't update any application
on the server. Only raisonable explenation I have is that their must be some
kind of file corrupt after copying it to the new disk.

grt,

Lieven

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

May 16 '06 #9
Rik
Lieven wrote:
No, that is the whole problem. The mail function doesn't work
anymore. After a hard disk crash I copied the whole corrupt hard
disk to a new disk, everything else is working perfectly afterworths
except php scripts that are using the mail() function are getting the
internal server error. I didn't change anything to my configuration
files or didn't update any application on the server. Only raisonable
explenation I have is that their must be some kind of file corrupt
after copying it to the new disk.


I'd say, allthough a terrible job, back up settings and files, and install
everything as new. Who knows what else has become corrupt, that you just
haven't found out? It could be a simple function that doesn't work, it could
you're having a major security risk somewhere.

Grtz,
--
Rik Wasmus
May 16 '06 #10
Lieven wrote:
Lieven,

Did you try asking the authors of the PHP class? Not knowing what it does
(or even which class it is) makes it impossible to tell what's going on.


This script is just the normal phpmailer
(http://phpmailer.sourceforge.net/), there you can specify that you want to
use smtp like this:
$mailman = new PHPMailer();

$mailman->IsSMTP();

Using this tool, sending mails from our php scripts works, but it is
impossible to ask all our customers to change their php scripts.
Does a simple mail() command work? That would be the place to start if
you're asking in this group.

No, that is the whole problem. The mail function doesn't work anymore. After
a hard disk crash I copied the whole corrupt hard disk to a new disk,
everything else is working perfectly afterworths except php scripts that are
using the mail() function are getting the internal server error. I didn't
change anything to my configuration files or didn't update any application
on the server. Only raisonable explenation I have is that their must be some
kind of file corrupt after copying it to the new disk.

grt,

Lieven

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================



Well, it's always possible a file got corrupted. Especially since you copied
files from a corrupt hard disk.

At this point I agree with Rik - you need to reinstall at least sendmail, php
and apache for a start. You should be able to keep your configuration files
(after ensuring they aren't corrupt), but get the rest of the files installed
with fresh copies.

Otherwise you may be spending days trying to find this bug - and even when you
find it, you wouldn't know if you might have another (more serious) bug.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 16 '06 #11



Well, it's always possible a file got corrupted. Especially since you
copied files from a corrupt hard disk.

At this point I agree with Rik - you need to reinstall at least sendmail,
php and apache for a start. You should be able to keep your configuration
files (after ensuring they aren't corrupt), but get the rest of the files
installed with fresh copies.

Otherwise you may be spending days trying to find this bug - and even when
you find it, you wouldn't know if you might have another (more serious)
bug.

Ok I think this will be indeed the right solution. I will reinstalled it and
I hope it will be fixed afterwards. Thanks for the support!!

grt,

Lieven
May 18 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tanya | last post by:
Running a PHP mail script on Linux which has Exchange as the mail server. The script does not send mail to any internal email address but sends it to any other address outside its domain! Can...
5
by: paul brown | last post by:
Hi, I have this website that contains an internal message system that allows users to send each other "email" messages. My client wants me to extend the system so that when a user receives an...
1
by: Raziel? | last post by:
Greetings, When Installing Visual Studio .NET the following error occurs: Internal Error 25300 I've tried setup in safemode and the same error occurs. The disk is brand new and clean.
7
by: David Berry | last post by:
I'm trying to use a recordset inside of a function but I'm getting an "object required 'adoRS" error. At the top of the page I create my recordset, ex: dim strConnection, adoCN, adoRS, strSQL...
8
by: Drew | last post by:
I am trying to setup an error reporting system for our Intranet. We have a Windows 2000 Server with SQL Server and we have an Exchange Server 5.5. I need to set it up so I can use CDO mail. I...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
2
by: GD | last post by:
Hi, An intranet application, with a SMTP mail function that lets users to attach files with emails by selecting files in their local computers (through a file browser component), works perfect on...
0
by: howardr101 | last post by:
Hi, Have hunted around on the groups and can't find anything, hence. I've tried this against 2 mail servers (mailtraq and hmailserver) and it occus with both. The problems seems to be that...
5
by: Gordon | last post by:
I'm working on a reset password script for my CMS, that will generate a random password and email it to a user when they request one. The problem I am having is that the mails being sent out are...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.