public function mime_mail::build_message in Backup and Migrate 7.3
Same name and namespace in other branches
- 8.2 includes/destinations.email.inc \mime_mail::build_message()
- 8.3 includes/destinations.email.inc \mime_mail::build_message()
- 6.3 includes/destinations.email.inc \mime_mail::build_message()
- 6.2 includes/destinations.email.inc \mime_mail::build_message()
- 7.2 includes/destinations.email.inc \mime_mail::build_message()
1 call to mime_mail::build_message()
- mime_mail::build_multipart in includes/
destinations.email.inc
File
- includes/
destinations.email.inc, line 125 - Functions to handle the email backup destination.
Class
Code
public function build_message($part) {
$crlf = "\r\n";
// See RFC 2184.
$continuation = $crlf . ' ';
$name = $part['name'];
$len = strlen($name);
// RFC 5322 recommends lines of no longer than 78 chars, which in
// this case comes down to filenames of no longer than 64 chars.
if ($len > 64) {
// We want to preserve the time stamp and extension and such.
$head = substr($name, 0, 28);
$tail = substr($name, $len - 32);
$name = $head . '___' . $tail;
}
$message = chunk_split(base64_encode($part["message"]), 70, $crlf);
$disposition = $name ? "Content-Disposition: attachment; {$continuation}filename=\"{$name}\"{$crlf}" : "";
return "Content-Type: " . $part["ctype"] . ($name ? ";{$continuation}name=\"{$name}\"" : "") . "{$crlf}Content-Transfer-Encoding: base64{$crlf}{$disposition}{$crlf}{$message}";
}