Unknown error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
imran.rajani
Forum Newbie
Posts: 16
Joined: Tue Dec 22, 2009 5:34 pm

Unknown error

Post by imran.rajani »

Hello Experts,

I'm new in php.

I tried to use following codes but getting "Server error - HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request." in chrome and no response in FireFox.

Code: Select all

		$myheaders  = "MIME-Version: 1.0\r\n";
		$myheaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
		$myheaders .= "From:Albert<'abc@xyz.com'>\r\n";

		ini_set('sendmail_from', 'abc@xyz.com');
		mail('def@hotmail.com',$subject,$body,$myheaders);
I used exactly the same code in different file and working fine.

I really couldn't have figure out therefore writing here with hope that somebody will surely help me.

Thanks in advance.
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: Unknown error

Post by fugix »

i would try

Code: Select all

$myheaders .= "From:Albert<abc@xyz.com>\r\n";
instead of what you have...the quotes dont look right to me....just a thought though
imran.rajani
Forum Newbie
Posts: 16
Joined: Tue Dec 22, 2009 5:34 pm

Re: Unknown error

Post by imran.rajani »

fugix wrote:i would try

Code: Select all

$myheaders .= "From:Albert<abc@xyz.com>\r\n";
instead of what you have...the quotes dont look right to me....just a thought though
still not working :(
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: Unknown error

Post by fugix »

well keep the quotes out of the from header because i know that they are not supposed to be there. I will look into this quick and get back to you soon
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: Unknown error

Post by fugix »

try this...

Code: Select all

$myheaders  = "MIME-Version: 1.0" . "\r\n";
                $myheaders .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
                $myheaders .= "From:Albert <abc@xyz.com>" . "\r\n";
imran.rajani
Forum Newbie
Posts: 16
Joined: Tue Dec 22, 2009 5:34 pm

Re: Unknown error

Post by imran.rajani »

fugix wrote:try this...

Code: Select all

$myheaders  = "MIME-Version: 1.0" . "\r\n";
                $myheaders .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
                $myheaders .= "From:Albert <abc@xyz.com>" . "\r\n";
I'm not so lucky :)
not working....

is there any other way to generate email?

Thanks
Peter Kelly
Forum Contributor
Posts: 143
Joined: Fri Jan 14, 2011 5:33 pm
Location: England
Contact:

Re: Unknown error

Post by Peter Kelly »

Check in error_log its a file that logs all errors. It should be in the same directory as that page.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Unknown error

Post by social_experiment »

imran.rajani wrote:Server error - HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request
This isn't an syntax error.

Server+error+-+HTTP+Error+500
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: Unknown error

Post by fugix »

the header syntax that I gave you i am certain is correct....so we eliminated that...I would say that your php.ini file is not set up correctly for SMTP mail requests....might want to check you php.ini file for that
Post Reply