Login   Register  
PHP Classes
elePHPant
Icontem

append_mail

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      IMAP  >  All threads  >  append_mail  >  (Un) Subscribe thread alerts  
Subject:append_mail
Summary:Implementation of the APPEND command for uploading new messages
Messages:2
Author:Anders Jenbo
Date:2009-12-21 22:01:18
Update:2012-03-30 08:04:02
 

  1. append_mail   Reply   Report abuse  
Picture of Anders Jenbo
Anders Jenbo
2009-12-21 22:01:18
This class realy miss an append function... so i wrote one :)

Just copy this to the end of the class


/* The append_mail saves the provided message to the
specified destination mailbox
Example : append_mail("saved-messages","Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
From: Fred Foobar <foobar@Blurdybloop.COM>
Subject: afternoon meeting
To: mooch@owatagu.siam.edu
Message-Id: <B27397-0100000@Blurdybloop.COM>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII

Hello Joe, do you think we can meet at 3:30 tomorrow?", "\Seen")

This can also be used with phpMailer
$phpMailer->Send()
append_mail("INBOX.Sent", $phpMailer->CreateHeader().$phpMailer->CreateBody(), "\Seen");
*/

function append_mail($mailbox, $msg, $flags='')
{
$mailbox =trim($mailbox);

$this->put_line($this->tag." APPEND ".$mailbox." (".$flags.") {".mb_strlen($msg)."}");

if($this->put_line($msg))
{
$response=$this->get_server_responce();
if(substr($response,strpos($response,"$this->tag ")+strlen($this->tag)+1,2)!="OK")
{
$this->error= "Error : $response !<br>";
return false;
}
}
else
{
$this->error= "Error : Could not send User request. <br>";
return false;
}
return $response;
}

  2. Re: append_mail   Reply   Report abuse  
Picture of Anders Jenbo
Anders Jenbo
2012-03-30 08:04:02 - In reply to message 1 from Anders Jenbo
This function is now part of my rewrite of this class https://github.com/AJenbo/PHP-imap