00001 <?php
00002 require_once dirname(__FILE__) . '/attachments.builder.php';
00003 require_once dirname(__FILE__) . '/singlemessage.builder.php';
00004
00005
00006
00007
00008 class AlternativeMessageBuilder extends AttachmentsBuilder {
00009
00010
00011
00012
00013
00014 protected $alt_message;
00015
00016
00017
00018
00019
00020
00021
00022
00023 public function __construct($msg, $mime, $alt) {
00024 parent::__construct(new SingleMessageBuilder($msg, $mime), array());
00025 $this->alt_message = $alt;
00026 }
00027
00028
00029
00030
00031
00032
00033 public function get_mail_mime() {
00034 return 'multipart/alternative; boundary=' . $this->get_boundary();
00035 }
00036
00037
00038
00039
00040
00041
00042 public function get_body() {
00043 $blocks = array();
00044 $altbuilder = new SingleMessageBuilder($this->alt_message, MailMessage::MIME_TEXT_PLAIN);
00045 $blocks[] = $this->create_block(
00046 $altbuilder->get_mail_mime(), false, $altbuilder->get_body(), $altbuilder->get_additional_headers()
00047 );
00048 $blocks[] = $this->create_block(
00049 $this->message_builder->get_mail_mime(), false, $this->message_builder->get_body(), $this->message_builder->get_additional_headers()
00050 );
00051 return
00052 $this->start_seperator($this->boundary) .
00053 implode("\n" . $this->start_seperator($this->boundary), $blocks) .
00054 $this->end_seperator($this->boundary);
00055 }
00056 }