Page 1 of 1

Unknown error

Posted: Mon Mar 28, 2011 7:27 pm
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.

Re: Unknown error

Posted: Mon Mar 28, 2011 7:36 pm
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

Re: Unknown error

Posted: Mon Mar 28, 2011 8:35 pm
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 :(

Re: Unknown error

Posted: Mon Mar 28, 2011 8:40 pm
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

Re: Unknown error

Posted: Mon Mar 28, 2011 8:50 pm
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";

Re: Unknown error

Posted: Tue Mar 29, 2011 6:17 am
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

Re: Unknown error

Posted: Tue Mar 29, 2011 7:37 am
by Peter Kelly
Check in error_log its a file that logs all errors. It should be in the same directory as that page.

Re: Unknown error

Posted: Tue Mar 29, 2011 12:54 pm
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

Re: Unknown error

Posted: Tue Mar 29, 2011 2:35 pm
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