Page 1 of 2

mail() error

Posted: Mon Jan 02, 2006 2:31 am
by jaylin
When i used mail() function to send email, if the message is in a small amount, it works fine. but, if the message is large, it doesn't work. i want to know why? is there any limit for email message? i m using

Code: Select all

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
i got this error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@@xx.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.
how can i solve that?
regards,

Posted: Mon Jan 02, 2006 11:01 pm
by djot
-
Try to break up your code/text with line breaks (\n) from time to time. Too long code without line breaks does not work (as I read in this forum).

djot
-

Posted: Mon Jan 02, 2006 11:55 pm
by mickd
mail()

"Each line should be separated with a LF (\n). Lines should not be larger than 70 characters."

Posted: Tue Jan 03, 2006 4:50 am
by jaylin
it does't work. it still display the same error. plz help me

Posted: Tue Jan 03, 2006 4:52 am
by mickd
is mail enabled on the server? some free hosts disable mail.

EDIT: just reread the original post, nevermind...

Posted: Tue Jan 03, 2006 4:53 am
by jaylin
it works fine for the single record. but, for more than 1 record, it makes error. my idea is to show the record in email. i think it may b the configuration error or php error. plz point me the way to solve this

Posted: Wed Jan 04, 2006 11:25 pm
by jaylin
Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


here my code:

Code: Select all

$subject = "Daily Order - " . $maxid;
$message = "";

$message = $message . "<table cellpadding=2 cellspacing=0 width=100%>\r\n";
$message = $message . "<tr>\r\n";
$message = $message . "<td colspan=2 align=center><font face=tahoma size=4>Daily Order</font></td>\r\n";
$message = $message . "</tr>\r\n";
$message = $message . "<tr>\r\n";
$message = $message . "<td colspan=2>\r\n";
$message = $message . "<table cellpadding=10 cellspacing=5 border=1>\r\n";
$message = $message . "<tr>\r\n";
$message = $message . "<td><font face=tahoma size=2><b>User Name:</b></font></td>\r\n";
$message = $message . "<td><font face=tahoma size=2>" . $_COOKIE['userid'] . "</font></td>\r\n";
$message = $message . "</tr>\r\n";
$message = $message . "<tr>\r\n";
$message = $message . "<td><font face=tahoma size=2><b>Country:</b></font></td>\r\n";
$message = $message . "<td><font face=tahoma size=2>" . $_COOKIE['country'] . "</font></td>\r\n";
$message = $message . "</tr>\r\n";
$message = $message . "<tr>\r\n";
$message = $message . "<td><font face=tahoma size=2><b>Order Date:</b></font></td>\r\n";
$message = $message . "<td><font face=tahoma size=2>$today</font></td>\r\n";
$message = $message . "</tr>\r\n";
$message = $message . "</table>\r\n";
$message = $message . "</td>\r\n";
$message = $message . "</tr>\r\n";
$message = $message . "<tr>\r\n";
$message = $message . "<td colspan=2>\r\n";

$message = $message . "<table cellpadding=3 border=1>\r\n";
$message = $message . "<tr bgcolor=pink>\r\n";
$message = $message . "<td><font><b>Entry No</b></font></td>\r\n";
$message = $message . "<td><font><b>Buyer Price</b></font></td>\r\n";

//$message = $message . "<td><font face=tahoma size=3><b>Entry No</b></font></td>\n";
//$message = $message . "<td><font face=tahoma size=3><b>Buyer Price</b></font></td>\n";

$message = $message . "<td colspan=2><font><b>Image</b></font></td>\r\n";
$message = $message . "</tr>\r\n";

		$no = 0;
		foreach($buyerprices as $eachbuyer)
		{
			$message = $message . "<tr>\r\n";
			$message = $message . "<td><a href='http://www.mywebsite.com/test/abc.php?id="  . $ids[$no] . "' target=_blank>" . $serialnumbers[$no] . "</a></td>\r\n";
			$message = $message . "<td>" . $eachbuyer . "</td>\r\n";
			$message = $message . "<td><img width=100 src='http://www.mywebsite.com/test/images/" . $img1[$no] . "'></td>\r\n";
			$message = $message . "<td><img width=100 src='http://www.mywebsite.com/test/images/" . $img2[$no] . "'></td>\r\n";
			$message = $message . "</tr>\r\n";
			$no++;
		}
		$message = $message . "</table>\r\n";
		$message = $message . "</td>\r\n";
		$message = $message . "</tr>\r\n";
		$message = $message . "</table>\r\n";
		$headers  = "MIME-Version: 1.0\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
		$headers .= "From: " . $_COOKIE['email'] . "\r\n";
		mail($to, $subject, $message, $headers);
Please Help me


Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Thu Jan 05, 2006 12:32 am
by mickd
btw, not related to the problem but you could write your code like this instead:

Code: Select all

$message = 'this ';
$message .= 'is ';
$message .= 'a ';
$message .= 'string.';
echo $message; //this is a string.

Posted: Thu Jan 05, 2006 12:35 am
by jaylin
is there any difference?

Posted: Thu Jan 05, 2006 1:27 am
by Charles256
easier to read? :-D

Posted: Thu Jan 05, 2006 1:35 am
by jaylin
sorry guy. now i m very serious abt this problem. can another one solve for me? is only because of the memory, execution limit of server?

Posted: Thu Jan 05, 2006 1:50 am
by Charles256
google phpmailer.use that.secondly. hum...maybe instead of foreach do a while loop..

Code: Select all

while($buyer=mysql_fetch_object($query))
not that it should make any difference but... : shrugs :
edit: btw,what error does it output?

Posted: Thu Jan 05, 2006 2:16 am
by jaylin
i have showed the error in my first post of this thread. is there any way to change the php.ini in the server. i want to configure the php configuration of web server. is there any code to change?

Posted: Thu Jan 05, 2006 6:58 am
by Charles256
do you know where your server error log is? go there and see what it said too! :-D

Posted: Mon Jan 09, 2006 12:12 am
by jaylin
in the error log, it says
malformed header from script
so, how can i solve it?