PHPMailer::getSentMIMEMessage PHP Method

getSentMIMEMessage() public method

Includes complete headers and body. Only valid post preSend().
See also: PHPMailer::preSend()
public getSentMIMEMessage ( ) : string
return string
    public function getSentMIMEMessage()
    {
        return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody;
    }

Usage Example

Example #1
2
 function enviar()
 {
     if ($this->cliente->getAccessToken()) {
         $service = new Google_Service_Gmail($this->cliente);
         try {
             $mail = new PHPMailer();
             $mail->CharSet = "UTF-8";
             $mail->From = Contants::FROM;
             $mail->FromName = Contants::ALIAS;
             $mail->AddAddress($this->destino);
             $mail->AddReplyTo(Contants::FROM, Contants::ALIAS);
             $mail->Subject = $this->asunto;
             $mail->Body = $this->mensaje;
             $mail->preSend();
             $mime = $mail->getSentMIMEMessage();
             $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '=');
             $mensaje = new Google_Service_Gmail_Message();
             $mensaje->setRaw($mime);
             $service->users_messages->send('me', $mensaje);
             $r = 1;
         } catch (Exception $e) {
             print $e->getMessage();
             $r = 0;
         }
     } else {
         $r = -1;
     }
     return $r;
 }
All Usage Examples Of PHPMailer::getSentMIMEMessage