2011-02-25 9 views
2

Zend_Mail_Messageを別の受信者に転送する簡単な方法はありますか?Forward Zend_Mail_Message

件名に「FWD:」という受信者アドレスを追加し、添付ファイルまたはインラインメッセージとして既存のZend_Mail_Messageを転送します。

+1

ことがありますしかし、あなたは常に手動で、件名を変更、受信者の追加、および古いメッセージから添付ファイルを作成することができますか? – akond

+0

@akond:簡単なことはmailoが言ったことです - ちょうど古いメールを 'Zend_Mail'に入れて' send() 'します – Laimoncijus

答えて

4

あなたは

$oldMail = new Zend_Mail_Storage_Imap(); 
$mail = new Zend_Mail($oldMail); 
$mail->addTo($oneEmail); 
$mail->send(); 

のようなものを意味している場合次にいいえ、それは不可能です。

//connect with imap 
$oldMail = new Zend_Mail_Storage_Imap(array(
            'host'  => 'example.com', 
            'user'  => 'test', 
            'password' => 'test')); 
$newBody = $_POST['body']; //new body text 
//If you want to download previous message 
$messageNum = 8; //you have to know message number 
$oldMessage = $mail->getMessage($messageNum); //in order to get it 

$mail = new Zend_Mail(); 
$mail->addTo($oldMail->getEmail()) 
    ->setSubject('RE: ' . $message->subject) 
    ->setBodyText($newBody); 

//create an attachment 
$attachment = $mail->createAttachment($message->getContent()); 
$attachment->type = 'text/plain'; 
$attachment->filename = 'RE.txt'; 
$message->addAttachment($attachment); 

$mail->addTo($email); 
$mail->send(); 

はまた、これはあなたが簡単に呼び出すかどうhelpful

関連する問題