Ejemplo n.º 1
0
 /**
  * Constructor
  * @param mixed The data to use in the body
  * @param string Mime type
  * @param string The encoding format used
  * @param string The charset used
  */
 public function __construct($data = null, $name = null, $type = "application/octet-stream", $encoding = "base64", $disposition = "attachment")
 {
     parent::__construct();
     $this->setContentType($type);
     $this->setEncoding($encoding);
     $this->setDescription($name);
     $this->setDisposition($disposition);
     $this->setFileName($name);
     if ($data !== null) {
         $this->setData($data, $name === null);
     }
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  * @param mixed The data to use in the body
  * @param string Mime type
  * @param string The encoding format used
  * @param string The charset used
  */
 public function __construct($data = null, $type = "text/plain", $encoding = null, $charset = null)
 {
     parent::__construct();
     $this->setContentType($type);
     $this->setEncoding($encoding);
     $this->setCharset($charset);
     $this->setFlowed(false);
     if ($data !== null) {
         $this->setData($data);
         if ($charset === null) {
             Swift_ClassLoader::load("Swift_Message_Encoder");
             if (is_string($data) && Swift_Message_Encoder::instance()->isUTF8($data)) {
                 $this->setCharset("utf-8");
             } else {
                 $this->setCharset("iso-8859-1");
             }
             //The likely encoding
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Ctor.
  * @param string Message subject
  * @param string Body
  * @param string Content-type
  * @param string Encoding
  * @param string Charset
  */
 public function __construct($subject = "", $body = null, $type = "text/plain", $encoding = null, $charset = null)
 {
     parent::__construct();
     if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) {
         date_default_timezone_set(@date_default_timezone_get());
     }
     $this->setReturnPath(null);
     $this->setTo("");
     $this->setFrom("");
     $this->setCc(null);
     $this->setBcc(null);
     $this->setReplyTo(null);
     $this->setSubject($subject);
     $this->setDate(time());
     if (defined("Swift::VERSION")) {
         $this->libVersion = Swift::VERSION;
         $this->headers->set("X-LibVersion", $this->libVersion);
     }
     $this->headers->set("MIME-Version", "1.0");
     $this->headers->set("X-Mailjet-Partner", "prestashop");
     $this->setContentType($type);
     $this->setCharset($charset);
     $this->setFlowed(true);
     $this->setEncoding($encoding);
     foreach (array_keys($this->references["parent"]) as $key) {
         $this->setReference("parent", $key, $this);
     }
     $this->setMimeWarning("This is a message in multipart MIME format.  Your mail client should not be displaying this. " . "Consider upgrading your mail client to view this message correctly.");
     if ($body !== null) {
         $this->setData($body);
         if ($charset === null) {
             Swift_ClassLoader::load("Swift_Message_Encoder");
             if (Swift_Message_Encoder::instance()->isUTF8($body)) {
                 $this->setCharset("utf-8");
             } else {
                 $this->setCharset("iso-8859-1");
             }
         }
     }
 }