sub send_mail { $CONFIG{mail_format} = 2; if($smtp_path =~ /\w+/){ $CONFIG{mailprogram} = $smtp_path; $CONFIG{mailuser} = $smtp_user; $CONFIG{mailpass} = $smtp_pass; return &send_mail_NT(@_); } #### my ($sndrEml, $sndrNme, $rcvrEml, $rcvrNme, $subject, $message, $ccrcEml, $ccrcNme, $attPths) = @_; #### $sndrNme =~ s/\</\//ig; $rcvrNme =~ s/\<.*?>//ig; $subject =~ s/\<.*?>//ig; $ccrcNme =~ s/\<.*?>//ig; #### sub _clean_value { local $_ = shift; s/\</\//ig; $_; } #### $sndrNme = _clean_value($sndrNme); $rcvrNme = _clean_value($sndrNme); $subject = _clean_value($subject); $ccrcNme = _clean_value($ccrcNme); #### ($sndrNme, $rcvrNme, $subject, $ccrcNme) = map { s/\</\//ig; $_; } ($sndrNme, $rcvrNme, $subject, $ccrcNme); #### sub send_email { # Set up values that *all* the EMail senders will need to know $CONFIG{mail_format} = 2; # Which method should we use to send the EMail? if($smtp_path =~ /\w+/){ # specific values used by send_mail_NT $CONFIG{mailprogram} = $smtp_path; $CONFIG{mailuser} = $smtp_user; $CONFIG{mailpass} = $smtp_pass; return send_mail_NT(@_); } else { # Our default method if no better method was found $CONFIG{mailprogram} = $send_mail_path; return send_mail_Default(@_); } } sub send_email_Default { my ($sndrEml, $sndrNme, $rcvrEml, $rcvrNme, $subject, $message, $ccrcEml, $ccrcNme, $attPths) = @_; my $Host = gethostname; my $CRLF = "\n"; my $message .= qq~$CRLF$CRLF~ .= qq~IP Address: $ENV{REMOTE_ADDR}$CRLF~ . qq~Host Node: $Host$CRLF~ . qq~User Agent: $ENV{HTTP_USER_AGENT}~; $message =~ s/\r//ig; $message =~ s/\n{3,300}/$CRLF$CRLF/ig; $attPths =~ s/\s+//ig; my $HTMLmess = $message; my $TEXTmess = $message; $TEXTmess =~ s/\"/"/g; $TEXTmess =~ s/\</\//ig; $_; } ($sndrNme, $rcvrNme, $subject, $ccrcNme); my $bound1 = qq~----=_NextPart_P_115Dream~; # printable my $bound2 = qq~----=_NextPart_A_SubHB~; # attachments my $bound3 = qq~----=_NextPart_E_SlowTrain~; # embded my $fm = _fixNme($sndrEml, $sndrNme); my $to = _fixNme($sndrEml, $sndrNme); my $cc = _fixNme($sndrEml, $sndrNme); if(open(M, qq~|$CONFIG{mailprogram} -t ~)){ print M qq~From: $fm$CRLF~; print M qq~To: $to$CRLF~; print M qq~CC: $cc$CRLF~ if $ccrcEml; print M qq~Subject: $subject$CRLF~; print M qq~MIME-Version: 1.0$CRLF~; print M qq~$VAR{fileHeaders}~; print M qq~Content-Type: text/plain;$VAR{CRLF}~; print M qq~Content-Transfer-Encoding: 7bit$VAR{CRLF}$VAR{CRLF}~; print M qq~$VAR{TEXTmess}$VAR{CRLF}$VAR{CRLF}$VAR{files}~; close M; return 1; } else { return; } } sub _fixNme { my ($Eml, $Nme) = @_; return $Nme =~ /\w+/ ? qq~$Eml ($Nme)~ : $Eml; }