Here is a draft patch to add support for sending compressed MIME emails using mime-construct. I choosed this over mimencode from metamail as the former is able to add the required headers while the latter depend on us to do it. I prefer to leave the responsibitilty of getting the MIME headers right to someone else, and thus selected mime-construct.
A few things need to be decided or done before it can go into the archive: - Is the MIME type a good one? Really wanted to use simliar headers as the HTTP headers, but mime-construct do not support x-gzip as a content encoding. The content is text, and the encoding is both x-gzip and base64. No idea how to represent that in MIME, so I picked application/x-popcon-compressed as the content type instead. - The receiving end need to be written. mimedecode might perhaps be used there? Here is my proposed client side patch, relative to the current CVS: Index: debian/changelog =================================================================== RCS file: /cvsroot/popcon/popularity-contest/debian/changelog,v retrieving revision 1.199 diff -u -3 -p -u -r1.199 changelog --- debian/changelog 4 Jul 2005 21:48:19 -0000 1.199 +++ debian/changelog 4 Jul 2005 23:09:26 -0000 @@ -28,6 +28,8 @@ popularity-contest (1.30) UNRELEASED; ur missing, to make it compatible with dpkg versions before 1.10. Drop versioned dependency on dpkg. This make a backport to woody trivial. + * Send compressed MIME emails when recommended package + mime-construct is installed. (Closes: #149425) * Translations (Done by Christian Perrier) - Updated French from Christian Perrier Index: debian/control =================================================================== RCS file: /cvsroot/popcon/popularity-contest/debian/control,v retrieving revision 1.13 diff -u -3 -p -u -r1.13 control --- debian/control 4 Jul 2005 21:51:03 -0000 1.13 +++ debian/control 4 Jul 2005 23:09:26 -0000 @@ -9,7 +9,7 @@ Standards-Version: 3.6.1 Package: popularity-contest Architecture: all Depends: ${misc:Depends}, exim4 | mail-transport-agent, ${perl:Depends} -Recommends: cron +Recommends: cron, mime-construct Suggests: anacron Provides: popcon Description: Vote for your favourite packages automatically Index: debian/cron.weekly =================================================================== RCS file: /cvsroot/popcon/popularity-contest/debian/cron.weekly,v retrieving revision 1.9 diff -u -3 -p -u -r1.9 cron.weekly --- debian/cron.weekly 4 Jul 2005 21:39:27 -0000 1.9 +++ debian/cron.weekly 4 Jul 2005 23:09:26 -0000 @@ -50,16 +50,40 @@ run_popcon > $POPCON # try to email the popularity contest data if [ -x "`which sendmail 2>/dev/null`" ]; then - ( - if [ -n "$MAILFROM" ]; then - echo "From: <$MAILFROM>" - echo "Sender: <$MAILFROM>" + if [ -x "`which mime-construct 2>/dev/null`" ]; then + # Make compresssed email + if [ -n "$MAILFROM" ]; then + gzip -9 < $POPCON | mime-construct \ + --type application/x-popcon-compressed \ + --encoding base64 --file - \ + --subject "popularity-contest submission" \ + --to "$MAILTO" \ + --header "From: <$MAILFROM>" \ + --header "Sender: <$MAILFROM>" \ + --output # | do_sendmail + else + gzip -9 < $POPCON | mime-construct \ + --type application/x-popcon-compressed \ + --encoding base64 --file - \ + --subject "popularity-contest submission" \ + --to "$MAILTO" \ + --output # | do_sendmail + fi + else + # Not able to make compressed email, send uncompressed + ( + if [ -n "$MAILFROM" ]; then + echo "From: <$MAILFROM>" + echo "Sender: <$MAILFROM>" + fi + echo "To: $MAILTO" + echo "Subject: popularity-contest submission" + echo "MIME-Version: 1.0" + echo "Content-Type: text/plain" + echo + cat $POPCON + ) | do_sendmail fi - echo "To: $MAILTO" - echo "Subject: popularity-contest submission" - echo - cat $POPCON - ) | do_sendmail else logger -t popcon "unable to submit report using sendmail." fi -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]