Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Bonjour je vous livre brut de fonderie pas encore testé la classe
Fast_Mail
ajout de quelque bricole à Zend_Mail
<?php /** * Fast_Mail Add some features to Zend_Mail. * - addReplyTo * - AddEmbedded * - addAlternative * - createFromTemplate */ Zend_Loader::loadClass('Zend_Mail'); class Fast_Mail extends Zend_Mail { /** * Adds a "Reply-to" address. * @param string $email * @param string $name * @return void */ public function AddReplyTo($email, $name = "") { $this->_addRecipientAndHeader('Reply-to', $name, $email); } /** * Adds an embedded attachment. This can include images, sounds, and * just about any other document. Make sure to set the $type to an * image type. For JPEG images use "image/jpeg" and for GIF images * use "image/gif". * @param string $body Path to the attachment or data or resource handler. * @param string $cid Content ID of the attachment. Use this to identify * the Id for accessing the image in an HTML form. * @param string $name Overrides the attachment name. * @param string $encoding File encoding (see $Encoding). * @param string $type File extension (MIME) type. * @return Zend_Mail Provides fluent interface */ public function AddEmbedded($body, $mimeType = Zend_Mime::TYPE_OCTETSTREAM, $encoding = Zend_Mime::ENCODING_BASE64, $cid, $fileName = null) { if(is_file($body)) { $body = fopen($body); } $mp = $this->createAttachment($body, $mimeType, Zend_Mime::DISPOSITION_INLINE, $encoding, $fileName); $mp->id = $cid; return $this; } /** * Creates a Zend_Mime_Part alternative * * Attachment is automatically added to the mail object after creation. The * attachment object is returned to allow for further manipulation. * * @param string $body * @param string $mimeType * @param string $encoding * @return Zend_Mail Provides fluent interface */ public function addAlternative($body, $mimeType = Zend_Mime::TYPE_OCTETSTREAM, $encoding = Zend_Mime::ENCODING_BASE64) { if(is_file($body)) { $body = fopen($body); } $mp = $this->createAttachment($body, $type, Zend_Mime::MULTIPART_ALTERNATIVE, $encoding); return $this; } /** * Decodes a MIME encoded string and returns a Zend_Mime_Message object with * all the MIME parts set according to the given string * * @param string $message * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @return Zend_Mime_Message */ public static function createFromTemplate($message, $EOL = Zend_Mime::LINEEND) { require_once 'Zend/Mime/Decode.php'; Zend_Mime_Decode::splitMessage($message, $headers, $body, $EOL) return Zend_Mime_Message::createFromMessage($message, $headers['boundary'], $EOL), } }
A+JYT
Hors ligne