Mailed database backups have mal-formed attachments
markdionne - December 18, 2006 - 02:47
| Project: | Database Administration |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
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";
}

#1
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
#2
I haven't tested this (yet) but at least here's a patch.
#3
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.