Related questions about sending mail with the Phpmailer class

Source: Internet
Author: User
Issues related to sending messages with the Phpmailer class.
[size=12px] has a createbody () method in the Phpmailer class, [/size]
The code is as follows:
/**
* Assembles the message body. Returns an empty string on failure.
* @access Public
* @return string the assembled message body
*/
Public Function Createbody () {
$body = ";

if ($this->sign_key_file) {
$body. = $this->getmailmime ();
}

$this->setwordwrap ();

Switch ($this->message_type) {
Case ' Alt ':
$body. = $this->getboundary ($this->boundary[1], ', ' text/plain ', ');
$body. = $this->encodestring ($this->altbody, $this->encoding);
$body. = $this->le. $this->le;
$body. = $this->getboundary ($this->boundary[1], ', ' text/html ', ');
$body. = $this->encodestring ($this->body, $this->encoding);
$body. = $this->le. $this->le;
$body. = $this->endboundary ($this->boundary[1]);
Break
Case ' plain ':
$body. = $this->encodestring ($this->body, $this->encoding);
Break
Case ' attachments ':
$body. = $this->getboundary ($this->boundary[1], ",", ");
$body. = $this->encodestring ($this->body, $this->encoding);
$body. = $this->le;
$body. = $this->attachall ();
Break
Case ' alt_attachments ':
$body. = sprintf ("--%s%s", $this->boundary[1], $this->le);
$body. = sprintf ("Content-type:%s;%s". "\tboundary=\"%s\ "%s", ' multipart/alternative ', $this->le, $this->boundary[2], $this->le. $this->le);
$body. = $this->getboundary ($this->boundary[2], ', ' text/plain ', '). $this->le; Create text Body
$body. = $this->encodestring ($this->altbody, $this->encoding);
$body. = $this->le. $this->le;
$body. = $this->getboundary ($this->boundary[2], ', ' text/html ', '). $this->le; Create the HTML body
$body. = $this->encodestring ($this->body, $this->encoding);
$body. = $this->le. $this->le;
$body. = $this->endboundary ($this->boundary[2]);
$body. = $this->attachall ();
Break
}

if ($this->iserror ()) {
$body = ";
} elseif ($this->sign_key_file) {
try {
$file = Tempnam (', ' Mail ');
File_put_contents ($file, $body); TODO Check this worked
$signed = Tempnam ("", "signed");
if (@openssl_pkcs7_sign ($file, $signed, "file://". $this->sign_cert_file, Array ("file://". $this->sign_key_ File, $this->sign_key_pass), NULL)) {
@unlink ($file);
@unlink ($signed);
$body = file_get_contents ($signed);
} else {
@unlink ($file);
@unlink ($signed);
throw new Phpmailerexception ($this->lang ("signing"). Openssl_error_string ());
}
} catch (Phpmailerexception $e) {
$body = ";
if ($this->exceptions) {
Throw $e;
}
}
}

return $body;
}


Problem:
has been passed from the background. Option Array object, you need to set the contents of the option array object in a certain format in the body of the sending file, how can I set it????

------Solution--------------------
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.