Closed Bug 65101 Opened 24 years ago Closed 22 years ago

Mail::Sendmail patch for processmail

Categories

(Bugzilla :: Email Notifications, enhancement, P2)

2.13
Other
Other
enhancement

Tracking

()

RESOLVED DUPLICATE of bug 84876

People

(Reporter: bugzilla, Assigned: preed)

References

Details

(Whiteboard: MTAConfig)

Attachments

(2 files)

I was having trouble getting sendmail to work as we are using bugzilla on a 
private IP (192.168.1.) lan without any DNS for our internal network.  I hacked 
processmail to use the Mail::Sendmail module instead of using the sendmail 
program directly.

It is working here at my site but of cource YMMV.

FWIW.  I am going to have a look at getting this to work for whining as well.

The patch is below.

-ken

33a34,37
> use Mail::Sendmail;
> my $smtpserver="192.168.1.22";
> 
> 
585,586c589,590
<     open(SENDMAIL, "|/usr/lib/sendmail -ODeliveryMode=deferred -t") ||
<       die "Can't open sendmail";
---
> #    open(SENDMAIL, "|/usr/lib/sendmail -ODeliveryMode=deferred -t") ||
> #      die "Can't open sendmail";
588,589c592,593
<     print SENDMAIL trim($msg) . "\n";
<     close SENDMAIL;
---
> #    print SENDMAIL trim($msg) . "\n";
> #    close SENDMAIL;
591c595,610
<     
---
> 
>     my @msg = split /\n/,$msg;
>     (my $From = shift @msg) =~ s/From:\s*(.*)$/$1/;
>     (my $To = shift @msg) =~ s/To:\s*(.*)$/$1/;
>     (my $Cc = shift @msg) =~ s/Cc:\s*(.*)$/$1/;
>     (my $Subject = shift @msg) =~ s/Subject:\s*(.*)$/$1/;
>     $msg = join "\n", @msg;
>     my %mail;
>     $mail{From}=$From;
>     $mail{To}=$To;
>     $mail{Cc}=$Cc;
>     $mail{Subject}=$Subject;
>     $mail{Message}="$msg\n";
>     $mail{Smtp}=$smtpserver;
>     sendmail %mail;
> 
648,654c667,690
<                 open(SENDMAIL, 
<                      "|/usr/lib/sendmail -ODeliveryMode=deferred -t") ||
<                        die "Can't open sendmail";
< 
<                 print SENDMAIL $msg;
<                 close SENDMAIL;
<                 foreach my $n (split(/[, ]+/, "$tolist,$cclist")) {
---
>                 #open(SENDMAIL, 
>                 #     "|/usr/lib/sendmail -ODeliveryMode=deferred -t") ||
>                 #       die "Can't open sendmail";
> 
>                 #print SENDMAIL $msg;
>                 #close SENDMAIL;
>                 
>     my @msg = split /\n/,$msg;
>     (my $From = shift @msg) =~ s/From:\s*(.*)$/$1/;
>     (my $To = shift @msg) =~ s/To:\s*(.*)$/$1/;
>     (my $Cc = shift @msg) =~ s/Cc:\s*(.*)$/$1/;
>     (my $Subject = shift @msg) =~ s/Subject:\s*(.*)$/$1/;
>     $msg = join "\n", @msg;
>     my %mail;
>     $mail{From}=$From;
>     $mail{To}=$To;
>     $mail{Cc}=$Cc;
>     $mail{Subject}=$Subject;
>     $mail{Message}="$msg\n";
>     $mail{Smtp}=$smtpserver;
>     sendmail %mail;
> 
> 
> 		foreach my $n (split(/[, ]+/, "$tolist,$cclist")) {
660c696,697
<                 $logstr = "$logstr; mail sent to $tolist, $cclist";
---
>                 
> 		$logstr = "$logstr; mail sent to $tolist, $cclist";
Here is the diff for the CGI.pl file for the MailPassword function.  This could 
be cleanED up a bit, but it works.  I grep everything out of the resulting merge 
with the template file to keep changes to a minimum.

24a25,28
> use Mail::Sendmail;
> my $smtpserver="192.168.1.22";
> 
> 
26a31,32
> 
> 
605,607c611,648
<     open SENDMAIL, "|/usr/lib/sendmail -t";
<     print SENDMAIL $msg;
<     close SENDMAIL;
---
> #    open SENDMAIL, "|/usr/lib/sendmail -t";
> #    print SENDMAIL $msg;
> #    close SENDMAIL;
> 
>    #
>    # Grep info from $msg resulting from the template substitution above
>    #
>    my @msg = split /\n/,$msg;
>    (my $From = shift @msg) =~ s/From:\s*(.*)$/$1/;
>    (my $To = shift @msg) =~ s/To:\s*(.*)$/$1/;
>    (my $Cc = shift @msg) =~ s/Cc:\s*(.*)$/$1/;
>    (my $Subject = shift @msg) =~ s/Subject:\s*(.*)$/$1/;
>    $msg = join "\n", @msg;
>    
>    #
>    # Send message via Mail::Sendmail module
>    #
>    my %mail;
>    $mail{From}=$From;
>    $mail{To}=$To;
>    $mail{Cc}=$Cc;
>    $mail{Subject}=$Subject;
>    $mail{Message}="$msg\n";
>    $mail{Smtp}=$smtpserver;
>    sendmail %mail;
> 
> 
>    print $mail{From};
>    print "<br>";
>    print $mail{To};
>    print "<br>";
>    print $mail{Subject};
>    print "<br>";
>    print $mail{Smtp};
>    print "<br>";
>    print $mail{Message};
>    print "<br><br>";
> 
Here is the diff for CGI.pl again.  I left in my debug stuff in the previous 
one, sorry.

24a25,28
> use Mail::Sendmail;
> my $smtpserver="192.168.1.22";
> 
> 
26a31,32
> 
> 
605,607c611,635
<     open SENDMAIL, "|/usr/lib/sendmail -t";
<     print SENDMAIL $msg;
<     close SENDMAIL;
---
> #    open SENDMAIL, "|/usr/lib/sendmail -t";
> #    print SENDMAIL $msg;
> #    close SENDMAIL;
> 
>    #
>    # Grep info from $msg resulting from the template substitution above
>    #
>    my @msg = split /\n/,$msg;
>    (my $From = shift @msg) =~ s/From:\s*(.*)$/$1/;
>    (my $To = shift @msg) =~ s/To:\s*(.*)$/$1/;
>    (my $Cc = shift @msg) =~ s/Cc:\s*(.*)$/$1/;
>    (my $Subject = shift @msg) =~ s/Subject:\s*(.*)$/$1/;
>    $msg = join "\n", @msg;
>    
>    #
>    # Send message via Mail::Sendmail module
>    #
>    my %mail;
>    $mail{From}=$From;
>    $mail{To}=$To;
>    $mail{Cc}=$Cc;
>    $mail{Subject}=$Subject;
>    $mail{Message}="$msg\n";
>    $mail{Smtp}=$smtpserver;
>    sendmail %mail;
Adding keywords and nominating for 2.16.
Thanks for the patch!  Looks much cleaner this way.
Keywords: patch, review
OS: Windows ME → other
Target Milestone: --- → Bugzilla 2.16
Blocks: 70573
Whiteboard: MTAConfig
Depends on: 84876
No longer depends on: 84876
Blocks: 84876
Priority: -- → P3
Priority: P3 → P2
Mass moving to new product Bugzilla...
Assignee: tara → jake
Component: Bugzilla → Email
Product: Webtools → Bugzilla
Version: other → 2.13
This looks pretty good, apart from:
+my $smtpserver="192.168.1.22";
which looks suspicious :-)

This would save a lot of the "email doesn't work" hassle we've been getting, I
suspect, because I assume Mail::Sendmail is XP and deals with deferred delivery etc.

Gerv
I forgot about that $smtpserver variable.  That would obviously need to be put 
in a config file somwhere or added as an option on the parameters page.
*** Bug 57798 has been marked as a duplicate of this bug. ***
Ken: can you please update your patch to reflect that? Use Bugzilla's parameters
system (the one fronted by editparams.cgi).

Gerv
*** Bug 70573 has been marked as a duplicate of this bug. ***
That patch is agains the 2.10 source.  BTW.
The principle is sound, and the patch could be easily updated - I just want to
hear from Dave as to whether this is something he wants to do, as it involves
adding Yet Another Module Dependency.

Gerv
We are currently trying to wrap up Bugzilla 2.16.  We are now close enough to
release time that anything that wasn't already ranked at P1 isn't going to make
the cut.  Thus this is being retargetted at 2.18.  If you strongly disagree with
this retargetting, please comment, however, be aware that we only have about 2
weeks left to review and test anything at this point, and we intend to devote
this time to the remaining bugs that were designated as release blockers.
Target Milestone: Bugzilla 2.16 → Bugzilla 2.18
I like this, but there one other option besides adding another module dependancy.

What we can do is have three functions in globals.pl

OpenMail
CloseMail
PrintMail
PrintMailHeader

It would wrap the open close and print functions, along with allowing you to add
the header by supplying all the parameters at once to PrintMailHeader.

This way, all you would have to do is change the wrapper code and we wouldn't
add another dependency. We could even have nearby commented out versions of the
wrapper code that people could uncomment and use on the fly - for instance one
to use Net::SMTP instead of Windmail, sendmail, etc.
Changing default owner of Email Notifications component to JayPee, a.k.a.
J. Paul Reed (preed@sigkill.com).  Jake will be offline for a few months.
Assignee: jake → preed
No longer blocks: 84876
Depends on: 84876
No longer blocks: 70573
Gerv, JayPee: How does this relate to the MTA do-it-all-mega-fix and your
discussion about the proper way of implementing things there?
I think that, whichever of the new email systems gets chosen, this patch will
probably never get checked in. I'm sure it's a good patch, but it's just not
quite what we want right now :-)

Gerv
Sorry Jouni... the bugmail for this must've slipped through the cracks.

But yeah... basically what Gerv said. 

I think at one point, he was talking about using Mail::Sendmail *or*
Mail::Bulkmail, i.e. we were evaluating the merits of both, but we're redoing
the whole MTA framework, so this patch really doesn't apply (haha) as such anymore.

-jpr
Resolving all bugs complaining about sendmail-specific/hard-coded MTA problems
as dupes of bug 84876.

Fixing these issues is inclusive in the fix for that bug, now.

Cc yourself to that bug if you care to watch the madness.


*** This bug has been marked as a duplicate of 84876 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
clearing milestone on all DUPLICATE/WONTFIX/WORKSFORME/INVALID so they'll show
up as untriaged if they get reopened.  "Jiminy Cricket!" for the filters (and I
don't care if it's spelled wrong ;)
Target Milestone: Bugzilla 2.18 → ---
No longer depends on: 84876
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: