function send(Message $message) { $body = $message->getBody(); //Read INI $smtp = ini_get("SMTP"); $port = ini_get("smtp_port"); //Set INI ini_set("SMTP", $this->host); ini_set("smtp_port", $this->port); //Send mail parent::Send($message, $body); //reset INI ini_set("SMTP", $smtp); ini_set("smtp_port", $port); }
function send(Message $message) { $body = $message->getBody(); $headers = ''; // To send HTML mail, the Content-type header must be set if ($message->getHtml()) { $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; } $headers .= 'From: ' . $message->getFrom() . "\r\n"; if ($message->getReplyTo()) { $headers .= 'Reply-To: ' . $message->getReplyTo() . "\r\n"; } mail($message->getTo(), $message->getSubject(), $body, $headers); }
function send(Message $message) { $body = $message->getBody(); $mail = $this->mailer(); $mail->From = $this->_getEmailPart($message->getFrom()); $mail->FromName = $this->_getNamePart($message->getFrom()); $mail->addAddress($this->_getEmailPart($message->getTo()), $this->_getNamePart($message->getTo())); // Add a recipient $mail->CharSet = 'UTF-8'; $mail->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)); if ($message->getReplyTo()) { $mail->addReplyTo($this->_getEmailPart($message->getReplyTo()), $this->_getNamePart($message->getReplyTo())); } foreach ($message->getAttachments() as $key => $file) { if (is_numeric($key)) { $mail->addAttachment($file); } else { $mail->addAttachment($file, $key, 'base64', \PHPMailer::filenameToType($key)); } } if ($message->getHtml()) { $mail->isHTML(true); // Set email format to HTML $mail->Body = $body; $mail->AltBody = $message->getAltBody(); } else { $mail->Body = $body; } $mail->Subject = $message->getSubject(); if ($message->getHeaders()) { foreach ($message->getHeaders() as $header => $value) { $mail->addCustomHeader($header, $value); } } return $mail->send(); }
function send(Message $m) { if (!$this->isLogin) { if (!$this->connect()) { return; } if (!$this->auth()) { return; } $this->isLogin = true; } $message = $m->getBody(); $from = $m->getFrom(); $to = $m->getTo(); $subject = $m->getSubject(); $headers = $m->getHeaders(); /* set up the headers and message body with attachments if necessary */ $email = "Date: " . date("D, j M Y G:i:s P") . $this->newline; $email .= "From: {$from}" . $this->newline; if ($m->getReplyTo()) { $email .= "Reply-To: " . $m->getReplyTo() . $this->newline; } $email .= $this->setRecipients($to); if ($headers != null) { foreach ($headers as $k => $v) { $email .= $k . ': ' . $v . $this->newline; } } $email .= "Subject: {$subject}" . $this->newline; $email .= "MIME-Version: 1.0" . $this->newline; if ($this->contentType == "multipart/mixed") { $boundary = $this->generateBoundary(); $message = $this->multipartMessage($message, $boundary); $email .= "Content-Type: {$this->contentType};" . $this->newline; $email .= " boundary=\"{$boundary}\""; } else { $email .= "Content-Type: {$this->contentType}; charset={$this->charset}"; } $email .= $this->newline . $this->newline . $message . $this->newline; $email .= "." . $this->newline; /* set up the server commands and send */ fputs($this->conn, 'MAIL FROM: <' . $this->getMailAddr($from) . '>' . $this->newline); $this->getServerResponse(); if (!$to == '') { fputs($this->conn, 'RCPT TO: <' . $this->getMailAddr($to) . '>' . $this->newline); $this->getServerResponse(); } $this->sendRecipients($this->recipients); $this->sendRecipients($this->cc); $this->sendRecipients($this->bcc); fputs($this->conn, 'DATA' . $this->newline); $this->getServerResponse(); fputs($this->conn, $email); /* transmit the entire email here */ $this->altBody = ''; if (substr($this->getServerResponse(), 0, 3) != '250') { return false; } return true; }