[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#321968: metamail: Does not provide filenames for attachments



Package: metamail
Version: 2.7-47
Severity: wishlist
Tags: patch


I'd like to be able to provide a filename for attachments sent with
metasend. I provide a patch which allows this:
With the new option "-A xxx", one can supply a filename. (This will add
a line 'Content-Disposition: attachment; filename="xxx"'; without the 
-A option, no Content-Disposition-line will be added.)
Some mail programs (sylpheed, for example), use the Content-Description
as a filename when it exists, but including the space at the beginning, 
after the ":", if there is one. So to get the filename correct even in 
sylpheed, I need to be able to turn off the Content-Description-line.
I therefore changed the behaviour such that no Content-Description-line
is created when the -D option is left out. (Anyway, the default 
Content-Description-line was "An object packed by metasend" which 
probably nobody really wanted.)

I only patched the program; I didn't modify the man-page accordingly.

Note that I'm not an experienced shell programmer, so perhaps someone 
should have a quick look over the new code.



-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.30-pcpool
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE (charmap=ISO-8859-1)

Versions of packages metamail depends on:
ii  libc6                       2.3.2.ds1-22 GNU C Library: Shared libraries an
ii  libncurses5                 5.4-4        Shared libraries for terminal hand

-- no debconf information
*** metasend	Mon Aug  8 15:47:50 2005
--- metasend_new	Mon Aug  8 16:09:16 2005
***************
*** 42,48 ****
  
  ouputfile=
  multipartsubtype=mixed
! cdescrip="An object packed by metasend"
  isentity=0
  newid=`date | tr " :" "__"`
  cid="<${newid}_$idctr@${hname}>"
--- 42,49 ----
  
  ouputfile=
  multipartsubtype=mixed
! cdescrip=    # -Immi
! attachfilename=    # -Immi
  isentity=0
  newid=`date | tr " :" "__"`
  cid="<${newid}_$idctr@${hname}>"
***************
*** 198,203 ****
--- 199,215 ----
  		    cdescrip=$1
  		    shift ;;
  
+ # begin immi
+ 		-A) shift
+ 		    if test -z "$*"
+ 		    then
+ 			echo "-A requires a following argument, the attachment file name"
+ 			exit 1
+ 		    fi
+ 		    attachfilename=$1
+ 		    shift ;;
+ #end immi
+ 
  		-E) isentity=1
  		    shift ;;
  
***************
*** 241,246 ****
--- 253,259 ----
  		    eval datafile${multipart}=$datafile
  		    eval encode${multipart}=$encode
  		    eval cdescrip${multipart}=\"$cdescrip\"
+ 		    eval attachfilename${multipart}=\"$attachfilename\"   # -Immi
  		    eval cid${multipart}=\"$cid\"
  		    eval isentity${multipart}=$isentity
  		    eval encodingprog${multipart}=\"\$encodingprog\"
***************
*** 252,258 ****
  		    newid=`date | tr " :" "__"`
  		    cid="<${newid}_$idctr@${hname}>"
  		    idctr=`expr $idctr + 1`
! 		    cdescrip="An object packed by metasend"
  		    isentity=0
  		    multipart=`expr $multipart + 1`
  		    shift ;;
--- 265,272 ----
  		    newid=`date | tr " :" "__"`
  		    cid="<${newid}_$idctr@${hname}>"
  		    idctr=`expr $idctr + 1`
! 		    cdescrip=             # -Immi
! 		    attachfilename=       # -Immi
  		    isentity=0
  		    multipart=`expr $multipart + 1`
  		    shift ;;
***************
*** 354,362 ****
  		    eval encode${multipart}=$encode
  		    eval encodingprog${multipart}=\"\$encodingprog\"
  		    eval cdescrip${multipart}=\"$cdescrip\"
  		    eval cid${multipart}=\"$cid\"
  		    eval isentity${multipart}=$isentity
! 		    cdescrip="An object packed by metasend"
  		    isentity=0
  		    ctype=
  		    datafile=
--- 368,378 ----
  		    eval encode${multipart}=$encode
  		    eval encodingprog${multipart}=\"\$encodingprog\"
  		    eval cdescrip${multipart}=\"$cdescrip\"
+ 		    eval attachfilename${multipart}=\"$attachfilename\"   # -Immi
  		    eval cid${multipart}=\"$cid\"
  		    eval isentity${multipart}=$isentity
! 		    cdescrip=         # -Immi
! 		    attachfilename=   # -Immi
  		    isentity=0
  		    ctype=
  		    datafile=
***************
*** 450,455 ****
--- 466,472 ----
  eval datafile${multipart}=$datafile
  eval encode${multipart}=$encode
  eval cdescrip${multipart}=\"$cdescrip\"
+ eval attachfilename${multipart}=\"$attachfilename\"   # -Immi
  eval cid${multipart}=\"$cid\"
  eval isentity${multipart}=$isentity
  eval encodingprog${multipart}=\"\$encodingprog\"
***************
*** 504,510 ****
  		then
  			eval echo "Content-ID: \$cid$i" >> $fname
  			eval echo "Content-type: \$ctype$i" >> $fname
! 			eval echo "Content-Description: \$cdescrip$i" >> $fname
  			eval echo "Content-Transfer-Encoding: \$encode$i" >> $fname
  			echo "" >> $fname
  		fi
--- 521,538 ----
  		then
  			eval echo "Content-ID: \$cid$i" >> $fname
  			eval echo "Content-type: \$ctype$i" >> $fname
! #begin immi
! 			eval cdescrip=\$cdescrip$i
! 			if test ! -z "$cdescrip"
! 			then
! 				echo "Content-Description: $cdescrip" >> $fname
! 			fi
! 			eval attachfilename=\$attachfilename$i
! 			if test ! -z "$attachfilename"
! 			then
! 				echo "Content-Disposition: attachment; filename=\"$attachfilename\"" >> $fname
! 			fi
! #end immi
  			eval echo "Content-Transfer-Encoding: \$encode$i" >> $fname
  			echo "" >> $fname
  		fi

Reply to: