Closed Bug 59351 Opened 24 years ago Closed 20 years ago

Move calls to sendmail to a central place

Categories

(Bugzilla :: Email Notifications, enhancement, P2)

2.13
enhancement

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: jvromans, Assigned: mkanat)

References

Details

(Whiteboard: MTAConfig)

Attachments

(1 file, 2 obsolete files)

Currently, the facilities to send email messages are hardwired to the sendmail
program, and distributed through the sources.
The attached patch:
  - moves all sendmail handling code to globals.pl, routine MailMessage.
  - additionally, this routine is prepared to use PostFix instead of sendmail.
  - replaces all calls to sendmail to use the new routine.

As a result, changes to the MTA, for example to use PostFix instead of sendmail,
are now easy to apply, in just one central location.

Remark1: Some parts of the old code did not check for sendmail errors. The patch
keeps this 'feature'? intact.
Remark2: A BugZilla config param could be added to select PostFix instead of
sendmail.
Getting this on the radar.  I like this patch.  Not sure if we want to keep the 
pipes or use a Perl module that handles mail based on your Perl config (there's a 
couple bugs out there for that with patches, too).
Target Milestone: --- → Bugzilla 2.16
We could even do both: modularize the code to make it easier to maintain
(this patch) and use the proper Perl module (patch for bug 65101).
Keywords: patch
OS: Linux → All
Hardware: PC → All
Summary: What if I'm not using sendmail → Move calls to sendmail to a central place (globals.pl)
*** Bug 80284 has been marked as a duplicate of this bug. ***
Whiteboard: MTAConfig
Depends on: 84876
No longer depends on: 84876
Blocks: 84876
Priority: P3 → P2
Mass moving to new product Bugzilla...
Assignee: tara → jake
Component: Bugzilla → Email
Product: Webtools → Bugzilla
Version: other → 2.13
I'd go for bug 65101 as well.

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
Johan, can you get this patch updated for 2.16? I will be available to review
this for the following week if you can, I _really_ like it.
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
*** Bug 139253 has been marked as a duplicate of this bug. ***
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
Now that bug 84876 has been acknowledged as impossible to resolve, and has once
again become a meta-bug, this is a valid and good goal to have in an individual bug.
Blocks: 84876
Severity: normal → enhancement
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Blocks: 178370
OK! Here's a patch to do EXACTLY and ONLY what the summary of this bug wants.
It was the FASTEST patch I've ever written in my life; it was practically just
a dumb series of vi commands to get this thing. :-)

Amazing that it's taken four years.

Anyhow, this should be relatively simple to review -- it's "obviously correct,"
and I do assert that I tested it and it behaves properly.

It does touch everybody's code in the whole world, though, so I figured
justdave might want to check it out.
Assignee: preed → mkanat
Attachment #18860 - Attachment is obsolete: true
Status: REOPENED → ASSIGNED
Attachment #169349 - Flags: review?(justdave)
Summary: Move calls to sendmail to a central place (globals.pl) → Move calls to sendmail to a central place
Comment on attachment 169349 [details] [diff] [review]
Modern patch to do only what the summary says

Arrggh. Because of the broken Test Installs on landfill (they try to use
:pserver:justdave to access cvs.mozilla.org for checkoiut), this patch is
incomplete. I'll re-post an actually complete patch.
Attachment #169349 - Attachment is obsolete: true
Attachment #169349 - Flags: review?(justdave)
OK, this patch is actually correct, and complete.
Attachment #169351 - Flags: review?(justdave)
Comment on attachment 169351 [details] [diff] [review]
Modern patch (corrected)

OOoooohhhhhh...   centralizes the freaking $enableSendMail check, so it
actually stops ALL mail and not just bugmail, too. :)  I like.
Haven't had a chance to test it yet though, so not marking review yet.
(In reply to comment #16)
> Created an attachment (id=169351) [edit]
> Modern patch (corrected)
> 
> OK, this patch is actually correct, and complete.


I like it but would go one step further. Remove $enableSendMail from BugMail.pm
and replace with a param (i.e. Param('enablesendmail')). This way it can be
switched on and off from remote rather that having to hand edit the code.
(In reply to comment #18)
> I like it but would go one step further. Remove $enableSendMail from BugMail.pm
> and replace with a param (i.e. Param('enablesendmail')). This way it can be
> switched on and off from remote rather that having to hand edit the code.

See bug 178370, which this bug blocks.
Comment on attachment 169351 [details] [diff] [review]
Modern patch (corrected)

r=gerv, except that "MessageToMTA" seems a bit specific. One day, this function
call might just call a Perl email-sending module. Can we just call it
sendMessage()?

This also clashes with my bug 73665 patch :-(

Gerv
Attachment #169351 - Flags: review?(justdave) → review+
*** Bug 276245 has been marked as a duplicate of this bug. ***
(In reply to comment #20)
> (From update of attachment 169351 [details] [diff] [review] [edit])
> r=gerv, except that "MessageToMTA" seems a bit specific. One day, this 
> function call might just call a Perl email-sending module. Can we just call it
> sendMessage()?

  Yeah, I was concerned about that, too. The reason that I called it
MessageToMTA was that we already have a function called "Send" in BugMail.pm,
and I didn't want to confuse people.

  When we have a perl mail-sending module, like Mail::Send, it will actually
still be sending to the MTA, so I figure it's an accurate statement. That is,
the end result of MessageToMTA will always be that the message gets to the MTA.

> This also clashes with my bug 73665 patch :-(

  Oh. I hope it's not a terrible clash, and that it's easy to fix.
Attachment #169351 - Flags: review+
There's a space identation issue below, but otherwise looks good.

+sub MessageToMTA ($) {
+   my ($msg) = (@_);
+
+    my $sendmailparam = "";
Flags: approval?
Flags: approval2.18?
> When we have a perl mail-sending module, like Mail::Send, it will actually
> still be sending to the MTA, so I figure it's an accurate statement. That is,
> the end result of MessageToMTA will always be that the message gets to the MTA.

Mail::Send contacts the remote SMTP server directly, right? Now you could argue
that this is an MTA, and it is, but I think that using messageToMTA when the
message is going to a remote MTA is confusing - that's what people normally call
"sending a message".

Don't worry about the name clash in BugMail.pm - my patch changes some of those
function names anyway. I'll make sure it's not confusing when I'm finished.

Gerv 
Flags: approval?
Flags: approval2.18?
Flags: approval2.18+
Flags: approval+
Target Milestone: --- → Bugzilla 2.18
Blocks: 232157
Blocks: 51300
Hey, I don't have checkin authority. Could somebody check this in for me?

It should apply cleanly to 2.18, but I didn't actually try it on the branch, as
I recall.
Checked in on trunk and branch. whine.pl does not exist on the branch, so that
part of the patch was not applied.

Checking in CGI.pl;
/cvsroot/mozilla/webtools/bugzilla/CGI.pl,v  <--  CGI.pl
new revision: 1.218; previous revision: 1.217
done
Checking in globals.pl;
/cvsroot/mozilla/webtools/bugzilla/globals.pl,v  <--  globals.pl
new revision: 1.279; previous revision: 1.278
done
Checking in importxml.pl;
/cvsroot/mozilla/webtools/bugzilla/importxml.pl,v  <--  importxml.pl
new revision: 1.37; previous revision: 1.36
done
Checking in move.pl;
/cvsroot/mozilla/webtools/bugzilla/move.pl,v  <--  move.pl
new revision: 1.28; previous revision: 1.27
done
Checking in whine.pl;
/cvsroot/mozilla/webtools/bugzilla/whine.pl,v  <--  whine.pl
new revision: 1.3; previous revision: 1.2
done
Checking in whineatnews.pl;
/cvsroot/mozilla/webtools/bugzilla/whineatnews.pl,v  <--  whineatnews.pl
new revision: 1.15; previous revision: 1.14
done
Checking in Bugzilla/BugMail.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/BugMail.pm,v  <--  BugMail.pm
new revision: 1.18; previous revision: 1.17
done
Checking in Bugzilla/Flag.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Flag.pm,v  <--  Flag.pm
new revision: 1.26; previous revision: 1.25
done
Checking in Bugzilla/Token.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Token.pm,v  <--  Token.pm
new revision: 1.24; previous revision: 1.23
done


Checking in CGI.pl;
/cvsroot/mozilla/webtools/bugzilla/CGI.pl,v  <--  CGI.pl
new revision: 1.211.2.4; previous revision: 1.211.2.3
done
Checking in globals.pl;
/cvsroot/mozilla/webtools/bugzilla/globals.pl,v  <--  globals.pl
new revision: 1.270.2.4; previous revision: 1.270.2.3
done
Checking in importxml.pl;
/cvsroot/mozilla/webtools/bugzilla/importxml.pl,v  <--  importxml.pl
new revision: 1.36.2.1; previous revision: 1.36
done
Checking in move.pl;
/cvsroot/mozilla/webtools/bugzilla/move.pl,v  <--  move.pl
new revision: 1.26.2.2; previous revision: 1.26.2.1
done
Checking in whineatnews.pl;
/cvsroot/mozilla/webtools/bugzilla/whineatnews.pl,v  <--  whineatnews.pl
new revision: 1.14.2.1; previous revision: 1.14
done
Checking in Bugzilla/BugMail.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/BugMail.pm,v  <--  BugMail.pm
new revision: 1.13.2.2; previous revision: 1.13.2.1
done
Checking in Bugzilla/Flag.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Flag.pm,v  <--  Flag.pm
new revision: 1.18.2.5; previous revision: 1.18.2.4
done
Checking in Bugzilla/Token.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Token.pm,v  <--  Token.pm
new revision: 1.22.2.2; previous revision: 1.22.2.1
done

Gerv
Status: ASSIGNED → RESOLVED
Closed: 22 years ago20 years ago
Resolution: --- → FIXED
The docs section in which we describe how to use Net::SMTP needs to be updated.
Flags: documentation?(documentation)
Flags: documentation2.18?(documentation)
Flags: documentation2.16?(documentation)
(In reply to comment #27)
> The docs section in which we describe how to use Net::SMTP needs to be
> updated.

I'm not fully conversant with this patch, but looking at the diffs it seems 
that the lines of code discussed in http://www.bugzilla.org/docs/2.18/html/os-
specific.html (specifically "2.4.1.3. Code changes required to run on win32") 
doesn't seem to have changed. What needs updating?

Travis, in reply to comment #28:

> doesn't seem to have changed. What needs updating?

$to is no longer available because we're sending to MessageToMTA the whole
message. The documentation is practically impossible to be updated.

Commiting bug 277437 would give qmail and SMTP support for all OSes and will
solve this documentation issue by removing the section altogether. But the hell
will be frozen if that gets approved for 2.18...
$to --> $person (in my previous comment)
(In reply to comment #29)
> Travis, in reply to comment #28:
> 
> > doesn't seem to have changed. What needs updating?
> 
> $to is no longer available because we're sending to MessageToMTA the whole
> message. The documentation is practically impossible to be updated.

Aha!  This changes the perspective on that other bug that I made a dupe before
on the pretext that it wasn't needed.  This wasn't pointed out over there, but
this gives that code an excuse to exist.  On the other hand, we could just
remove that altogether from the docs, and suggest people use Byron's sendmail
replacement drop-in.  It is a lot easier than modifying code.
(In reply to comment #31)

> Aha!  This changes the perspective on that other bug that I made a dupe before
> on the pretext that it wasn't needed.  This wasn't pointed out over there, but
> this gives that code an excuse to exist.  On the other hand, we could just
> remove that altogether from the docs, and suggest people use Byron's sendmail
> replacement drop-in.  It is a lot easier than modifying code.

I never managed to get Byron's sendmail working. I'd still like to be able to
run Bugzilla 2.18 with a SMTP server. I use it internally in this way at my
workplace, with the hack from the docs applied, and I bet a lot of other people
do it too. If SMTP functionality would be lost, I could find myself in a
position where I'd need to research possible Bugzilla replacements. This could
loose some market-share for us.

Bug 277437 offers for a dozen liners or so a clean solution to this, that brings
also qmail and SMTP support, hacking-free, and it also works on any OS and platform.
s/loose/lose/ in my previous comment, per Gerv's suggestion :)
This bug no longer needs documentation on the trunk, after the landing of bug
277437, which made it a paramater to send email. It probably does still need it
on the others though.
Flags: documentation?(documentation) → documentation-
Flags: documentation2.16?(documentation)
Per comment 34.
Flags: documentation2.18?(documentation)
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: