[1/2] mail.cgi: Fixes bug#13040 - Change multipart/mixed to multipart/alternative

Message ID 20230220163003.3434540-1-adolf.belka@ipfire.org
State Accepted
Commit 670981e64870b43981617560ce96b41db3a462fb
Headers
Series [1/2] mail.cgi: Fixes bug#13040 - Change multipart/mixed to multipart/alternative |

Commit Message

Adolf Belka Feb. 20, 2023, 4:30 p.m. UTC
  - Thunderbird and Roundcube mail clients presume that any mail with Content Type of
   multipart/mixed has an attachment included rather than actually checking for
   disposition attachment. This means that any mail with multipart/mixed gets the
   attachment icon marked up even though there is no attachment.
- Although this is a problem of the clients involved, in this case the simplest solution
   is to change multipart/mixed to multipart/alternative as the Mail Service test mail only
   sends text without any attachment or other part.
- Confirmed on my vm testbed

Fixes: Bug#13040
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 html/cgi-bin/mail.cgi | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
  

Comments

Bernhard Bitsch Feb. 20, 2023, 5:08 p.m. UTC | #1
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>

Am 20.02.2023 um 17:30 schrieb Adolf Belka:
> - Thunderbird and Roundcube mail clients presume that any mail with Content Type of
>     multipart/mixed has an attachment included rather than actually checking for
>     disposition attachment. This means that any mail with multipart/mixed gets the
>     attachment icon marked up even though there is no attachment.
> - Although this is a problem of the clients involved, in this case the simplest solution
>     is to change multipart/mixed to multipart/alternative as the Mail Service test mail only
>     sends text without any attachment or other part.
> - Confirmed on my vm testbed
> 
> Fixes: Bug#13040
> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
> ---
>   html/cgi-bin/mail.cgi | 11 +----------
>   1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/html/cgi-bin/mail.cgi b/html/cgi-bin/mail.cgi
> index 34f52ae01..0ed3dfeca 100644
> --- a/html/cgi-bin/mail.cgi
> +++ b/html/cgi-bin/mail.cgi
> @@ -297,7 +297,7 @@ sub testmail {
>   		To		=> $mail{'RECIPIENT'},
>   		#Cc		=> 'some@other.com, some@more.com',
>   		Subject	=> 'IPFire Testmail',
> -		Type	=> 'multipart/mixed'
> +		Type	=> 'multipart/alternative'
>   	);
>   
>   	### Add parts (each "attach" has same arguments as "new"):
> @@ -306,15 +306,6 @@ sub testmail {
>   		Data	=> "This is the IPFire test mail."
>   	);
>   
> -	### Add attachment for testing
> -	#$msg->attach(
> -	#	Type     => 'application/txt',
> -	#	Encoding => 'base64',
> -	#	Path     => '/var/ipfire/dma/dma.conf',
> -	#	Filename => 'dma.conf',
> -	#	Disposition => 'attachment'
> -	#);
> -
>   	$msg->send_by_sendmail;
>   }
>
  

Patch

diff --git a/html/cgi-bin/mail.cgi b/html/cgi-bin/mail.cgi
index 34f52ae01..0ed3dfeca 100644
--- a/html/cgi-bin/mail.cgi
+++ b/html/cgi-bin/mail.cgi
@@ -297,7 +297,7 @@  sub testmail {
 		To		=> $mail{'RECIPIENT'},
 		#Cc		=> 'some@other.com, some@more.com',
 		Subject	=> 'IPFire Testmail',
-		Type	=> 'multipart/mixed'
+		Type	=> 'multipart/alternative'
 	);
 
 	### Add parts (each "attach" has same arguments as "new"):
@@ -306,15 +306,6 @@  sub testmail {
 		Data	=> "This is the IPFire test mail."
 	);
 
-	### Add attachment for testing
-	#$msg->attach(
-	#	Type     => 'application/txt',
-	#	Encoding => 'base64',
-	#	Path     => '/var/ipfire/dma/dma.conf',
-	#	Filename => 'dma.conf',
-	#	Disposition => 'attachment'
-	#);
-
 	$msg->send_by_sendmail;
 }