function PHPMailer::CreateBody in SMTP Authentication Support 5
Same name and namespace in other branches
- 7.2 smtp.phpmailer.inc \PHPMailer::CreateBody()
- 7 smtp.phpmailer.inc \PHPMailer::CreateBody()
Assembles the message body. Returns an empty string on failure. @access private
Return value
string
1 call to PHPMailer::CreateBody()
- PHPMailer::Send in ./
smtp.module - Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.
File
- ./
smtp.module, line 1323 - Enables drupal to send email directly to an SMTP server using authentication. Uses the PHPMailer class by Brent R. Matzelle.
Class
- PHPMailer
- PHPMailer - PHP email transport class @package PHPMailer @author Brent R. Matzelle @copyright 2001 - 2003 Brent R. Matzelle
Code
function CreateBody() {
$result = "";
$this
->SetWordWrap();
switch ($this->message_type) {
case "alt":
$result .= $this
->GetBoundary($this->boundary[1], "", "text/plain", "");
$result .= $this
->EncodeString($this->AltBody, $this->Encoding);
$result .= $this->LE . $this->LE;
$result .= $this
->GetBoundary($this->boundary[1], "", "text/html", "");
$result .= $this
->EncodeString($this->Body, $this->Encoding);
$result .= $this->LE . $this->LE;
$result .= $this
->EndBoundary($this->boundary[1]);
break;
case "plain":
$result .= $this
->EncodeString($this->Body, $this->Encoding);
break;
case "attachments":
$result .= $this
->GetBoundary($this->boundary[1], "", "", "");
$result .= $this
->EncodeString($this->Body, $this->Encoding);
$result .= $this->LE;
$result .= $this
->AttachAll();
break;
case "alt_attachments":
$result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
$result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", "multipart/alternative", $this->LE, $this->boundary[2], $this->LE . $this->LE);
// Create text body
$result .= $this
->GetBoundary($this->boundary[2], "", "text/plain", "") . $this->LE;
$result .= $this
->EncodeString($this->AltBody, $this->Encoding);
$result .= $this->LE . $this->LE;
// Create the HTML body
$result .= $this
->GetBoundary($this->boundary[2], "", "text/html", "") . $this->LE;
$result .= $this
->EncodeString($this->Body, $this->Encoding);
$result .= $this->LE . $this->LE;
$result .= $this
->EndBoundary($this->boundary[2]);
$result .= $this
->AttachAll();
break;
case "pre":
$result .= $this->Body;
}
if ($this
->IsError()) {
$result = "";
}
return $result;
}