Wnen emailed database backups generated by dba automatic backups arrive, the attachment has a null file name associated with it. The following code change seems to fix it. The main change is the addition of the "Content Disposition" line.

function build_message($part) {
$message = $part["message"];
$message = chunk_split(base64_encode($message));
$encoding = "base64";
$pre = "Content-Type: ".$part["ctype"].($part["name"]? "; name = \"".$part["name"]."\"" : "");
if ($part["name"]) $pre .= "\nContent-Disposition: attachment; filename=\"".$part["name"]."\"";
return $pre."\nContent-Transfer-Encoding: $encoding\n\n$message\n";
}

Comments

dww’s picture

again, can you attach a patch for this? it'll make it easier to review and commit if/when appropriate. see http://drupal.org/diffandpatch and/or http://drupal.org/patch for more details.

thanks!
-derek

greggles’s picture

Version: 4.7.x-1.0 » 5.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1 KB

I haven't tested this (yet) but at least here's a patch.

greggles’s picture

Yep, this has fixed it for the last few backup emails that I've received. I'd say it's RTBC, but didn't step through the code line by line and don't know enough about mail headers to say for sure... allI know is that before I got "unnamed" attachments and now they are named.

jeremy’s picture

Status: Needs review » Closed (won't fix)

The 5.x branch is no longer supported.