Yahoo receives empty mail?

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
User avatar
aquila125
Forum Commoner
Posts: 96
Joined: Tue Dec 09, 2003 10:39 am
Location: Belgium

Yahoo receives empty mail?

Post by aquila125 »

Hi there,

I'm a volunteer for a non profit organisation. I've made a mail script to mass mail our volunteers (just about 200). All volunteers get their mail, but those with a yahoo account get an empty mail.. Is there something wrong with the headers? I got part of this code from php.net
They have the possibility to add an attachment, and the heading of the mail is always the official heading...


This is the code:

Code: Select all

$from_name = "Mobileschool"; 
$from_email = $_POSTї'from']; 
 
$subject = $_POSTї'subject']; 

// headers need to be in the correct order... 
$headers = "From: $from_name<$from_email>\n"; 
$headers .= "Reply-To: <$from_email>\n"; 
$headers .= "MIME-Version: 1.0\n"; 
// the following must be one line (post width too small) 
$headers .= "Content-Type: multipart/related;type="multipart/alternative";boundary="----=MIME_BOUNDRY_main_message"\n"; 
// 
$headers .= "X-Sender: $from_name<$from_email>\n"; 
$headers .= "X-Mailer: PHP4\n"; //mailer 
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal 
$headers .= "Return-Path: <$from_email>\n"; 
$headers .= "This is a multi-part message in MIME format.\n"; 
$headers .= "------=MIME_BOUNDRY_main_message \n"; 
$headers .= "Content-Type: multipart/alternative; boundary="----=MIME_BOUNDRY_message_parts"\n"; 



// html section begins 
$message .= "------=MIME_BOUNDRY_message_parts\n"; 
$message .= "Content-Type: text/html;\n    charset="iso-8859-1"\n"; 
//$message .= "Content-Transfer-Encoding: quoted-printable\n"; 
$message .= "\n"; 

// your html goes here -- It didn't appear properly without 
// the weird markup that outlook added after sending 

$message .= "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\n"; 
$message .= "<HTML><BODY>\n"; 
$message .= "<table width="100%" border="0"><tr><td><img src="http://www.mobileschool.org/ms.jpg" border="0"></td>	<td>MOBIELE SCHOOL PROJECT<br>VZW MOBILE SCHOOL<br>Rek.nr: 735-0051653-37<br>Naamsestraat 159 - 3000 Leuven - 016/500 234<br>info@mobileschool.org - www.mobileschool.org	</td></tr></table><hr>	".nl2br(stripslashes($_POST&#1111;'msg']));
$message .= "</BODY></HTML>\n"; 
$message .= "\n"; 

// this ends the message part 
$message .= "------=MIME_BOUNDRY_message_parts--\n"; 
$message .= "\n"; 

// now we add attachments (images, etc) 
if (!empty($_FILES&#1111;'userfile']&#1111;'name']))&#123;
	
$message .= "------=MIME_BOUNDRY_main_message\n"; 
$message .= "Content-Type: image/octetstream; \n name="".$_FILES&#1111;'userfile']&#1111;'name'].""\n"; 
$message .= "Content-Transfer-Encoding: base64\n"; 
$message .= "\n"; 
// (truncated for space) 

	$Filename=$_FILES&#1111;'userfile']&#1111;'tmp_name'];
	$fd=fopen ($Filename, "r");
   $FileContent=fread($fd,filesize($Filename));
   fclose ($fd);
   $FileContent=chunk_split(base64_encode($FileContent));
   $message.=$FileContent;
   $message.="\n\n";
&#125;

$message .= "\n"; 

//message ends 
$message .= "------=MIME_BOUNDRY_main_message--\n"; 





	
	
/* and now mail it */
$i=0;
while (isset($_POST&#1111;$i]))&#123;
	set_time_limit(10);
	mail($_POST&#1111;$i], $subject, $message, $headers);
	$i++;
&#125;
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

User avatar
aquila125
Forum Commoner
Posts: 96
Joined: Tue Dec 09, 2003 10:39 am
Location: Belgium

Post by aquila125 »

If our mail was found to be spam (by Yahoo) it would've been moved to the trash.. not emptied out...

All of the message is correct (from, to, subject) just the message itself is empty...
Post Reply