2 ===================================================================
3 RCS file: /cvsroot/its/sw/wreq/req-config,v
4 retrieving revision 1.3
5 retrieving revision 1.4
6 diff -u -w -u -r1.3 -r1.4
7 --- req-config 1999/05/15 10:20:04 1.3
8 +++ req-config 1999/05/15 10:41:24 1.4
10 #### How to call sendmail on your system
11 $sendmail="/usr/lib/sendmail -oi"; # will -db make the page faster to return?
13 +#### If $sendmail is '', relay mails thru this host
14 +$mailhost='mailhost';
16 #### The From address for errors in processing email requests
17 #### Note: to prevent mail looping, this address doesn't actually exist.
18 $error_from="Support Online Error <req-error\@localhost>";
20 ===================================================================
21 RCS file: /cvsroot/its/sw/wreq/req-common,v
22 retrieving revision 1.1
23 retrieving revision 1.2
24 diff -u -w -u -r1.1 -r1.2
25 --- req-common 1999/05/09 21:51:08 1.1
26 +++ req-common 1999/05/15 10:41:24 1.2
28 sub sendMail {# . 0from 1reply-to 2tos 3ccs 4subject 5message
29 if(!$_[2]){return;} # no one to send to
31 - my $header=''; my $fflag=''; my $to='';
32 - if($_[0]){$header.="From: $_[0]\n";}
33 + my $header=''; my $fflag=''; my $to=''; my $from='';
34 + if($_[0]){$header.="From: $_[0]\n"; $from ="$_[0]";}
35 if($_[2]){$header.="To: $_[2]\n"; $to="$_[2]";}
36 if($_[4]){$header.="Subject: $_[4]\n";}
37 if($_[3]){$header.="Cc: $_[3]\n"; $to.=",$_[3]";}
39 $header.="\n$_[5]\n"; # the body
43 # note from/tos can be of the form: aa bb <a@b>
44 open(POUT,"|$sendmail $fflag \"$to\">/dev/null 2>&1") || &html_error("cannot run sendmail: $!");
45 # redirect above so it won't mess up the http header, eval{} works too.
47 ### -n option should not be used, since we are sending to aliases.
51 + eval 'use Net::SMTP;';
52 + $smtp = Net::SMTP->new($mailhost,
53 + Timeout => 30); # seconds
56 + for $user (split(/,/, $to)) {
60 + $smtp->datasend($header);
64 + &html_error("sendMail: SMTP connect to $mailhost failed");
68 &html_error("sendMail: $@") if $@;
71 ===================================================================
72 RCS file: /cvsroot/its/sw/wreq/req-mail,v
73 retrieving revision 1.3
74 retrieving revision 1.4
75 diff -u -w -u -r1.3 -r1.4
76 --- req-mail 1999/05/15 10:22:44 1.3
77 +++ req-mail 1999/05/15 10:41:24 1.4
79 sub sendMail {# . 0from 1reply-to 2tos 3ccs 4subject 5message
80 if(!$_[2]){return;} # no one to send to
82 - my $header=''; my $fflag=''; my $to='';
83 - if($_[0]){$header.="From: $_[0]\n";}
84 + my $header=''; my $fflag=''; my $to=''; my $from='';
85 + if($_[0]){$header.="From: $_[0]\n"; $from ="$_[0]";}
86 if($_[2]){$header.="To: $_[2]\n"; $to="$_[2]";}
87 if($_[4]){$header.="Subject: $_[4]\n";}
88 if($_[3]){$header.="Cc: $_[3]\n"; $to.=",$_[3]";}
90 $header.="\n$_[5]\n"; # the body
94 # note from/tos can be of the form: aa bb <a@b>
95 open(POUT,"|$sendmail $fflag \"$to\">/dev/null 2>&1") || &html_error("cannot run sendmail: $!");
96 # redirect above so it won't mess up the http header, eval{} works too.
98 ### -n option should not be used, since we are sending to aliases.
102 + eval 'use Net::SMTP;';
103 + $smtp = Net::SMTP->new($mailhost,
104 + Timeout => 30); # seconds
106 + $smtp->mail($from);
107 + for $user (split(/,/, $to)) {
111 + $smtp->datasend($header);
115 + &html_error("sendMail: SMTP connect to $mailhost failed");
119 &html_error("sendMail: $@") if $@;