Page 1 of 1

mail() problem with emails > 20k

Posted: Wed Oct 22, 2003 12:13 pm
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.

Posted: Wed Oct 22, 2003 12:56 pm
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.

Posted: Wed Oct 22, 2003 3:44 pm
by Cruzado_Mainfrm
try echoing $msgdata to the user and see if the file has been loaded correctly