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
jaylin
Forum Commoner
Posts: 68 Joined: Fri Nov 18, 2005 4:44 am
Post
by jaylin » Mon Jan 02, 2006 2:31 am
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,
Last edited by
jaylin on Thu Jan 05, 2006 2:11 am, edited 1 time in total.
djot
Forum Contributor
Posts: 313 Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:
Post
by djot » Mon Jan 02, 2006 11:01 pm
-
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
-
mickd
Forum Contributor
Posts: 397 Joined: Tue Jun 21, 2005 9:05 am
Location: Australia
Post
by mickd » Mon Jan 02, 2006 11:55 pm
mail()
"Each line should be separated with a LF (\n). Lines should not be larger than 70 characters."
jaylin
Forum Commoner
Posts: 68 Joined: Fri Nov 18, 2005 4:44 am
Post
by jaylin » Tue Jan 03, 2006 4:50 am
it does't work. it still display the same error. plz help me
mickd
Forum Contributor
Posts: 397 Joined: Tue Jun 21, 2005 9:05 am
Location: Australia
Post
by mickd » Tue Jan 03, 2006 4:52 am
is mail enabled on the server? some free hosts disable mail.
EDIT: just reread the original post, nevermind...
Last edited by
mickd on Tue Jan 03, 2006 4:54 am, edited 1 time in total.
jaylin
Forum Commoner
Posts: 68 Joined: Fri Nov 18, 2005 4:44 am
Post
by jaylin » Tue Jan 03, 2006 4:53 am
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
jaylin
Forum Commoner
Posts: 68 Joined: Fri Nov 18, 2005 4:44 am
Post
by jaylin » Wed Jan 04, 2006 11:25 pm
Jcart | Please use 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
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
mickd
Forum Contributor
Posts: 397 Joined: Tue Jun 21, 2005 9:05 am
Location: Australia
Post
by mickd » Thu Jan 05, 2006 12:32 am
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.
jaylin
Forum Commoner
Posts: 68 Joined: Fri Nov 18, 2005 4:44 am
Post
by jaylin » Thu Jan 05, 2006 12:35 am
is there any difference?
jaylin
Forum Commoner
Posts: 68 Joined: Fri Nov 18, 2005 4:44 am
Post
by jaylin » Thu Jan 05, 2006 1:35 am
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?
Charles256
DevNet Resident
Posts: 1375 Joined: Fri Sep 16, 2005 9:06 pm
Post
by Charles256 » Thu Jan 05, 2006 1:50 am
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?
jaylin
Forum Commoner
Posts: 68 Joined: Fri Nov 18, 2005 4:44 am
Post
by jaylin » Thu Jan 05, 2006 2:16 am
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?
Charles256
DevNet Resident
Posts: 1375 Joined: Fri Sep 16, 2005 9:06 pm
Post
by Charles256 » Thu Jan 05, 2006 6:58 am
do you know where your server error log is? go there and see what it said too!
jaylin
Forum Commoner
Posts: 68 Joined: Fri Nov 18, 2005 4:44 am
Post
by jaylin » Mon Jan 09, 2006 12:12 am
in the error log, it says
malformed header from script
so, how can i solve it?