PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Does $message->get() have a limit?

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail
View previous topic :: View next topic  
Author Message
ctmtech



Joined: 13 Oct 2010
Posts: 1

PostPosted: Wed Oct 13, 2010 5:43 pm    Post subject: Does $message->get() have a limit? Reply with quote

I just recently started working with PEAR mail-mime. My code works to send a text email has long as the attachment size is less than 24.9MB. The upload script uploads files and places them in a folder named the session id. When the code gets to the $body=$message->get(); line the script stops running. I'm using just a single large PDF to test. I would really appreciate knowing if there's a size limit when using PEAR or what's wrong with my code. Thank you in advance.

Code:
session_start();
$mysession=session_id();
$text = $_POST['message'];
$sendto = $_POST['sendto'];
$visitorname = $_POST['name'];
$visitoremail = $_POST['email'];
$uploadDirectory="uploadedfiles/".$mysession;
$num=0;
$handle=opendir($uploadDirectory);
while (($file = readdir($handle))!==false) {
if (substr($file,0,1)!='.'){
$num=$num+1;
}
}
closedir($handle);
if($num==0)
{ echo "<b>Please upload prior to clicking the Send button.</b>";
$mline="<br><br><FORM><INPUT TYPE=\"button\" VALUE=\"Back\" onClick=\"history.go(-1);return true;\"> </FORM>";
print $mline;
return false;
}
$subject="File from ".$visitorname;
$text=$text."\n\n\nNOTE: This message was sent securely.";
include_once('Mail.php');
include_once('mail/mime.php');
$message = new Mail_mime();
$message->setTXTBody($text);
if ($num>1) {
$subject="Files from ".$visitorname;
}
$handle=opendir($uploadDirectory);
while (($file = readdir($handle))!==false) {
if (substr($file,0,1)!='.'){
$filenme=$uploadDirectory."/".$file;
echo "Attaching ".$file."...";
$message->addAttachment($filenme);
echo "Done!<br>";
}
}
closedir($handle);
$body = $message->get();
$extraheaders = array("From"=>$visitoremail,"Subject"=>$subject,"Reply-To"=>$visitoremail);
$headers=$message->headers($extraheaders);
$mail=Mail::factory("mail");
$emresult=$mail->send($sendto,$headers,$body);
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement