|
@@ -363,6 +363,12 @@ $time_zone_type = '0' if ( !$time_zone_type );
|
|
|
$prefs_user_size = 128 if ( !$prefs_user_size );
|
|
|
$prefs_key_size = 64 if ( !$prefs_key_size );
|
|
|
$prefs_val_size = 65536 if ( !$prefs_val_size );
|
|
|
+# add qmail-inject test here for backwards compatibility
|
|
|
+if ( !$sendmail_args && $sendmail_path =~ /qmail-inject/ ) {
|
|
|
+ $sendmail_args = '';
|
|
|
+} elsif ( !$sendmail_args ) {
|
|
|
+ $sendmail_args = '-i -t';
|
|
|
+}
|
|
|
|
|
|
if ( $ARGV[0] eq '--install-plugin' ) {
|
|
|
print "Activating plugin " . $ARGV[1] . "\n";
|
|
@@ -456,7 +462,8 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) {
|
|
|
if ( lc($useSendmail) eq 'true' ) {
|
|
|
print $WHT . "Sendmail" . $NRM . "\n--------\n";
|
|
|
print "4. Sendmail Path : $WHT$sendmail_path$NRM\n";
|
|
|
- print "5. Header encryption key : $WHT$encode_header_key$NRM\n";
|
|
|
+ print "5. Sendmail arguments : $WHT$sendmail_args$NRM\n";
|
|
|
+ print "6. Header encryption key : $WHT$encode_header_key$NRM\n";
|
|
|
print "\n";
|
|
|
} else {
|
|
|
print $WHT . "SMTP Settings" . $NRM . "\n-------------\n";
|
|
@@ -721,7 +728,8 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) {
|
|
|
elsif ( $command == 9 ) { $optional_delimiter = command111(); }
|
|
|
} elsif ( $show_smtp_settings && lc($useSendmail) eq 'true' ) {
|
|
|
if ( $command == 4 ) { $sendmail_path = command15(); }
|
|
|
- elsif ( $command == 5 ) { $encode_header_key = command114(); }
|
|
|
+ elsif ( $command == 5 ) { $sendmail_args = command_sendmail_args(); }
|
|
|
+ elsif ( $command == 6 ) { $encode_header_key = command114(); }
|
|
|
} elsif ( $show_smtp_settings ) {
|
|
|
if ( $command == 4 ) { $smtpServerAddress = command16(); }
|
|
|
elsif ( $command == 5 ) { $smtpPort = command17(); }
|
|
@@ -1043,6 +1051,7 @@ sub command14 {
|
|
|
|
|
|
# sendmail_path
|
|
|
sub command15 {
|
|
|
+ # TODO: fix check
|
|
|
if ( $sendmail_path[0] !~ /./ ) {
|
|
|
$sendmail_path = "/usr/sbin/sendmail";
|
|
|
}
|
|
@@ -1057,6 +1066,27 @@ sub command15 {
|
|
|
return $new_sendmail_path;
|
|
|
}
|
|
|
|
|
|
+# Extra sendmail arguments
|
|
|
+sub command_sendmail_args {
|
|
|
+ print "Specify additional sendmail program arguments.\n";
|
|
|
+ print "\n";
|
|
|
+ print "Make sure that arguments are supported by your sendmail program. -f argument \n";
|
|
|
+ print "is added automatically by SquirrelMail scripts. Variable defaults to standard\n";
|
|
|
+ print "/usr/sbin/sendmail arguments. If you use qmail-inject, nbsmtp or any other \n";
|
|
|
+ print "sendmail wrapper, which does not support -i and -t arguments, set variable to\n";
|
|
|
+ print "empty string or use arguments suitable for your mailer.\n";
|
|
|
+ print "\n";
|
|
|
+ print "[$WHT$sendmail_args$NRM]: $WHT";
|
|
|
+ $new_sendmail_args = <STDIN>;
|
|
|
+ if ( $new_sendmail_args eq "\n" ) {
|
|
|
+ $new_sendmail_args = $sendmail_args;
|
|
|
+ } else {
|
|
|
+ # strip linefeeds and crs.
|
|
|
+ $new_sendmail_args =~ s/[\r\n]//g;
|
|
|
+ }
|
|
|
+ return trim($new_sendmail_args);
|
|
|
+}
|
|
|
+
|
|
|
# smtpServerAddress
|
|
|
sub command16 {
|
|
|
print "This is the hostname of your SMTP server.\n";
|
|
@@ -3420,6 +3450,8 @@ sub save_data {
|
|
|
print CF "\$smtpPort = $smtpPort;\n";
|
|
|
# string
|
|
|
print CF "\$sendmail_path = '$sendmail_path';\n";
|
|
|
+ # string
|
|
|
+ print CF "\$sendmail_args = '$sendmail_args';\n";
|
|
|
# boolean
|
|
|
# print CF "\$use_authenticated_smtp = $use_authenticated_smtp;\n";
|
|
|
# boolean
|
|
@@ -4057,6 +4089,17 @@ sub detect_auth_support {
|
|
|
return 'YES';
|
|
|
}
|
|
|
|
|
|
+# trims whitespace
|
|
|
+# Example code from O'Reilly Perl Cookbook
|
|
|
+sub trim {
|
|
|
+ my @out = @_;
|
|
|
+ for (@out) {
|
|
|
+ s/^\s+//;
|
|
|
+ s/\s+$//;
|
|
|
+ }
|
|
|
+ return wantarray ? @out : $out[0];
|
|
|
+}
|
|
|
+
|
|
|
sub clear_screen() {
|
|
|
if ( $^O =~ /^mswin/i) {
|
|
|
system "cls";
|