my $size = 0;
# Compute subject size
- $size += length($args{Subject});
+ $size += length($args{Subject}) if ( $args{Subject} );
# Compute body size
- $size += length($args{Content});
+ $size += length($args{Content}) if ( $args{Content} );
# Add attachments sizes if any
foreach my $file_name ( keys %{$args{'Attachments'}} ) {