Skip to content

Commit c7000a0

Browse files
committed
Merge branch 'jc/send-email-transferencoding-fix' into jch
* jc/send-email-transferencoding-fix: send-email: honor transferencoding config option again send-email: update the mechanism to set default configuration values
2 parents 87aec2b + e1bb1a3 commit c7000a0

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

git-send-email.perl

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ sub do_edit {
239239
my (@suppress_cc);
240240
my ($auto_8bit_encoding);
241241
my ($compose_encoding);
242-
my $target_xfer_encoding = 'auto';
242+
my ($target_xfer_encoding);
243243

244244
my ($debug_net_smtp) = 0; # Net::SMTP, see send_message()
245245

@@ -258,28 +258,28 @@ sub do_edit {
258258
);
259259

260260
my %config_settings = (
261-
"smtpserver" => \$smtp_server,
262-
"smtpserverport" => \$smtp_server_port,
263-
"smtpserveroption" => \@smtp_server_options,
264-
"smtpuser" => \$smtp_authuser,
265-
"smtppass" => \$smtp_authpass,
266-
"smtpdomain" => \$smtp_domain,
267-
"smtpauth" => \$smtp_auth,
268-
"smtpbatchsize" => \$batch_size,
269-
"smtprelogindelay" => \$relogin_delay,
270-
"to" => \@initial_to,
271-
"tocmd" => \$to_cmd,
272-
"cc" => \@initial_cc,
273-
"cccmd" => \$cc_cmd,
274-
"aliasfiletype" => \$aliasfiletype,
275-
"bcc" => \@bcclist,
276-
"suppresscc" => \@suppress_cc,
277-
"envelopesender" => \$envelope_sender,
278-
"confirm" => \$confirm,
279-
"from" => \$sender,
280-
"assume8bitencoding" => \$auto_8bit_encoding,
281-
"composeencoding" => \$compose_encoding,
282-
"transferencoding" => \$target_xfer_encoding,
261+
"smtpserver" => [\$smtp_server],
262+
"smtpserverport" => [\$smtp_server_port],
263+
"smtpserveroption" => [\@smtp_server_options],
264+
"smtpuser" => [\$smtp_authuser],
265+
"smtppass" => [\$smtp_authpass],
266+
"smtpdomain" => [\$smtp_domain],
267+
"smtpauth" => [\$smtp_auth],
268+
"smtpbatchsize" => [\$batch_size],
269+
"smtprelogindelay" => [\$relogin_delay],
270+
"to" => [\@initial_to],
271+
"tocmd" => [\$to_cmd],
272+
"cc" => [\@initial_cc],
273+
"cccmd" => [\$cc_cmd],
274+
"aliasfiletype" => [\$aliasfiletype],
275+
"bcc" => [\@bcclist],
276+
"suppresscc" => [\@suppress_cc],
277+
"envelopesender" => [\$envelope_sender],
278+
"confirm" => [\$confirm],
279+
"from" => [\$sender],
280+
"assume8bitencoding" => [\$auto_8bit_encoding],
281+
"composeencoding" => [\$compose_encoding],
282+
"transferencoding" => [\$target_xfer_encoding, 'auto'],
283283
);
284284

285285
my %config_path_settings = (
@@ -423,7 +423,7 @@ sub read_config {
423423
}
424424

425425
foreach my $setting (keys %config_settings) {
426-
my $target = $config_settings{$setting};
426+
my $target = $config_settings{$setting}->[0];
427427
next if $setting eq "to" and defined $no_to;
428428
next if $setting eq "cc" and defined $no_cc;
429429
next if $setting eq "bcc" and defined $no_bcc;
@@ -458,6 +458,16 @@ sub read_config {
458458
${$setting->[0]} = $setting->[1] unless (defined (${$setting->[0]}));
459459
}
460460

461+
# fall back to builtin defaults
462+
while (my ($name, $setting) = each %config_settings) {
463+
next unless @$setting == 2;
464+
465+
my ($target, $default) = @$setting;
466+
if (ref($target) eq "SCALAR") {
467+
$$target = $default unless defined $$target;
468+
} # elsif ... for other types later.
469+
}
470+
461471
# 'default' encryption is none -- this only prevents a warning
462472
$smtp_encryption = '' unless (defined $smtp_encryption);
463473

0 commit comments

Comments
 (0)