mail() problem with emails > 20k

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
ShedMeister
Forum Newbie
Posts: 1
Joined: Wed Oct 22, 2003 12:13 pm

mail() problem with emails > 20k

Post by ShedMeister »

Hi,

I have developed an email sending script to email approx 80 people with a html email approx 22k once a day. I developed the script on a windows box using Apache/1.3.27 and PHP Version 4.2.3 and it works OK. However when I run it on my hosted linux (2.4.19) server running Apache/1.3.27 and PHP Version 4.2.3 it strips out the middle chunk of the email restricting it to only 6k.

I tried sending the same email without html headers, but the email still came through as 6k. I cut down the size of the email to 8k and still it sends only 6k.

The emails are customised and exist as files in an email directory with the name of the file being the email address of the user. As said previously the code seems to work flawlessly on windows, but truncates emails on linux.

Code: Select all

<?php
$msgdata = "";
$emailfile = $dir."/".$file;
$fpi = fopen($emailfile,"r") 
	 or die("Error reading email data.");
while($data = fread($fpi, 40960)){
 $msgdata .= $data;
 }
fclose($fpi);
						
$bingo = @mail($file,"Newsletter", 
     $msgdata, 
		 "From:Admin <admin@mydomain.co.uk>\n" .
		 "MIME-Version: 1.0\n" . 
		 "Content-type: text/html; charset=iso-8859-1" 
);

if (!$bingo){
 LogMsg("Sendmail Failed $file");
}
?>

Any ideas, gratefully appreciated.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

The first thing which springs to mind is how the server is set-up.. there maybe something in there restricting the size of out-going/in-coming emails (possibly to protect against spam).

Get in touch with the server admin and ask..... or if you are the admin then check the server set-up/conf/ini file.
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

try echoing $msgdata to the user and see if the file has been loaded correctly
Post Reply