Skip to content

Commit a7e25ad

Browse files
Only require mail sending modules if we are actually sending mail
1 parent 2a7030b commit a7e25ad

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

scripts/zmfilter.pl.in

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,7 @@ if ( $Config{ZM_OPT_UPLOAD} ) {
119119
}
120120
}
121121

122-
if ( $Config{ZM_OPT_EMAIL} ) {
123-
if ( $Config{ZM_NEW_MAIL_MODULES} ) {
124-
require MIME::Lite;
125-
require Net::SMTP;
126-
} else {
127-
require MIME::Entity;
128-
}
129-
}
130122

131-
if ( $Config{ZM_OPT_MESSAGE} ) {
132-
if ( $Config{ZM_NEW_MAIL_MODULES} ) {
133-
require MIME::Lite;
134-
require Net::SMTP;
135-
} else {
136-
require MIME::Entity;
137-
}
138-
}
139123

140124
$| = 1;
141125

@@ -972,6 +956,8 @@ sub sendTheEmail {
972956

973957
eval {
974958
if ($Config{ZM_NEW_MAIL_MODULES}) {
959+
require MIME::Lite;
960+
require Net::SMTP;
975961
my $total_size = 0;
976962
# Create the multipart container
977963
my $mail = MIME::Lite->new(
@@ -1047,6 +1033,7 @@ sub sendTheEmail {
10471033
$mail->send();
10481034
}
10491035
} else {
1036+
require MIME::Entity;
10501037
my $total_size = 0;
10511038
my $mail = MIME::Entity->build(
10521039
From => $Config{ZM_FROM_EMAIL},
@@ -1145,6 +1132,8 @@ sub sendMessage {
11451132

11461133
eval {
11471134
if ( $Config{ZM_NEW_MAIL_MODULES} ) {
1135+
require MIME::Lite;
1136+
require Net::SMTP;
11481137
### Create the multipart container
11491138
my $mail = MIME::Lite->new(
11501139
From => $Config{ZM_FROM_EMAIL},
@@ -1189,6 +1178,7 @@ sub sendMessage {
11891178
$mail->send(smtp=>$Config{ZM_EMAIL_HOST}, Timeout=>60);
11901179
}
11911180
} else {
1181+
require MIME::Entity;
11921182
my $mail = MIME::Entity->build(
11931183
From => $Config{ZM_FROM_EMAIL},
11941184
To => $Config{ZM_MESSAGE_ADDRESS},

0 commit comments

Comments
 (0)