Closed
Bug 304005
Opened 19 years ago
Closed 16 years ago
Add SMTP auth support
Categories
(Bugzilla :: Email Notifications, enhancement, P1)
Tracking
()
RESOLVED
FIXED
Bugzilla 3.2
People
(Reporter: bugreport, Assigned: LpSolit)
References
Details
Attachments
(1 file, 1 obsolete file)
5.73 KB,
patch
|
mkanat
:
review+
|
Details | Diff | Splinter Review |
An irc user inquired about use of SMPT authentication. According to http://search.cpan.org/~markov/MailTools-1.67/Mail/Mailer.pm it should be possible to add the additional parameter Auth = [ $user, $password ] to the Mail::Mailer in order to work with mailservers that require authentication. To avoid parameter clutter, we could allow the smtpserver parameter to be specified as either "servername" or "server userid password" In the validation section of the parameter, we should ensure that Authen::SASL is installed and complain if it is not.
Reporter | ||
Updated•19 years ago
|
Priority: -- → P3
Target Milestone: --- → Bugzilla 2.22
Comment 1•19 years ago
|
||
I have a SMTP send error problem and saw this post. Is this a possible cause to my inability to send from my smtp based account? (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.6) Gecko/20050319 on XPSP2...) (In reply to comment #0) > An irc user inquired about use of SMPT authentication. > > According to http://search.cpan.org/~markov/MailTools-1.67/Mail/Mailer.pm it > should be possible to add the additional parameter > Auth = [ $user, $password ] > to the Mail::Mailer in order to work with mailservers that require authentication. > > To avoid parameter clutter, we could allow the smtpserver parameter to be > specified as either "servername" or "server userid password" > > In the validation section of the parameter, we should ensure that Authen::SASL > is installed and complain if it is not.
Assignee | ||
Comment 2•19 years ago
|
||
The trunk is now frozen to prepare Bugzilla 2.22. Enhancement bugs are retargetted to 2.24.
Target Milestone: Bugzilla 2.22 → Bugzilla 2.24
Assignee | ||
Comment 3•18 years ago
|
||
*** Bug 333750 has been marked as a duplicate of this bug. ***
(I'm just storing a mailing list response from: Thorsten Schöning) <-- Hello, i had the same problem with earlier versions of Bugzilla and used a workaround I found somewhere in a documentation with Net::SMTP. You should look in your BugMail.pm for the following code and change it. My problem with SMTP in Versions 2.20 was that I didn't understand where to save username, password etc. for bugzillas biultin SMTP-option so I used what worked in earlier version until I have enough time to fix the problem property with an own mail server oder something like that. Maybe it helps. MessageToMTA($msg, $user->email); #MessageToMTA($msg); return 1; } #sub MessageToMTA ($) { # my ($msg) = (@_); sub MessageToMTA ($;$) { my ($msg, $rcpt_to) = (@_); return if (Param('mail_delivery_method') eq "none"); # Thorsten: # Da wir derzeit nur SMTP nutzen und ich mit der Übergabe der # Authentifizierungsparameter an Mail::Mailer nicht klarkomme, # rufe ich wie vorher Net::SMTP direkt auf. use Net::SMTP; my $smtp_server = 'mail.domain.de'; # change this # Use die on error, so that the mail will be in the 'unsent mails' and # can be sent from the sanity check page. my $smtp = Net::SMTP->new($smtp_server) || die 'Cannot connect to server \'$smtp_server\''; $smtp->mail('bugzilla@domain.de'); # change this $smtp->to($rcpt_to); $smtp->auth('username', 'password'); $smtp->data(); $smtp->datasend($msg); $smtp->dataend(); $smtp->quit; return; if (Param("mail_delivery_method") eq "sendmail" && $^O =~ /MSWin32/i) { open(SENDMAIL, '|' . SENDMAIL_EXE . ' -t -i') || die "Failed to execute " . SENDMAIL_EXE . ": $!\n"; print SENDMAIL $msg; close SENDMAIL; return; } -->
Comment 5•18 years ago
|
||
I crafted a fix for this, because this is not an enhancement for me. I must have SMTP AUTH, because I now use a hosted email provider that demands it. I made the fixes in Bugzilla 2.20.1 because that's what we're running. Here's what we need:
Change defparams.pl to add new paramters smtpauthuser and smtpauthpasswd which are the ISP's user account name and password required for authorization.
You can put everything into one parameter as was mentioned, but I don't mind having a longer list, and I didn't want to have to do fancy parsing if the user has spaces or other funky stuff in a username or password.
Here's the diff of defparams.pl:
726a727,743
> # local modifications
> {
> name => 'smtpauthuser',
> desc => 'User account name for SMTP auth, if your SMTP server needs it.' .
> 'Leave blank if you don\'t need to authenticate',
> type => 't',
> default => ''
> },
>
> {
> name => 'smtpauthpasswd',
> desc => 'Password for the smtpauthuser',
> type => 't',
> default => ''
> },
> # end local modifications
>
The above will add two params just after 'smtpserver'.
Next, BugMail.pm needs to check for a defined value of smtpauthuser, and if set, push the SMTP AUTH params onto the list of server parameters in @args. Here's a diff of BugMail.pm:
656,661d655
< # Include authorization if credentials are defined
< if (Param("smtpauthuser") ne '') {
< my $smtpuser = Param("smtpauthuser");
< my $smtpauthpasswd = Param("smtpauthpasswd");
< push @args, Auth => [ $smtpuser, $smtpauthpasswd ];
< }
I did not complete the next part, which is to change checksetup.pl to test for the presence of two packages that Mail::Mailer requires. They are MIME::Base64 and Authen::SASL. Authen::SASL will have to be built using whatever underlying authentication your server needs, such as DIGEST-MD5. But if you use CPAN, you can have CPAN follow the dependencies to build what you need. I may try to figure out checksetup.pl and if I figure it out, I'll post changes.
I am using this after hacking my local installation. If the password contains Perl special characters like '@', I think they will need to be escaped in order to pass through. But the result of these changes produces two new parameters in the list produced by editparams.cgi, and it lets SMTP AUTH work.
I hope this helps. I tried to apply Thorstein's good work, but I found that MessageToMTA() was different in v 2.20.1. I can't use Bugzilla without authentication, so I had to do something right away. I hope that this is useful and can find its way into the real release.
Assignee | ||
Comment 6•18 years ago
|
||
This bug is retargetted to Bugzilla 3.2 for one of the following reasons: - it has no assignee (except the default one) - we don't expect someone to fix it in the next two weeks (i.e. before we freeze the trunk to prepare Bugzilla 3.0 RC1) - it's not a blocker If you are working on this bug and you think you will be able to submit a patch in the next two weeks, retarget this bug to 3.0. If this bug is something you would like to see implemented in 3.0 but you are not a developer or you don't think you will be able to fix this bug yourself in the next two weeks, please *do not* retarget this bug. If you think this bug should absolutely be fixed before we release 3.0, either ask on IRC or use the "blocking3.0 flag".
Target Milestone: Bugzilla 3.0 → Bugzilla 3.2
Comment 7•18 years ago
|
||
I'm in a quandary. I would very much like to see this in Bugzilla 3.0; not having this feature is a blocker for me, as I must use SMTP AUTH to use Bugzilla. At the moment, I am avoiding upgrading because I have to maintain this patch to keep Bugzilla working. I managed a patch to v2.20 (previously attached) that works for our installation and attached diffs for the affected Perl files. But I have two blocks: 1. I'm not a Bugzilla developer and have not been introduced to the dev team. 2. I don't know how to properly "present" a patch. 3. I don't have time to craft the updates to checksetup.pl that would be important for making this a real fix -- such as checking for the necessary mailer Perl modules. Is there any alternative that would get this into production code? Erik Erik
As a quick starting point for Erik: (In reply to comment #7) > 1. I'm not a Bugzilla developer and have not been introduced to the dev team. check http://www.bugzilla.org/developers/ , I think you can find already a lot of information. > 2. I don't know how to properly "present" a patch. check http://www.bugzilla.org/docs/contributor.html ? You will probably have to make the change using the 3.0 or tip version. > 3. I don't have time to craft the updates to checksetup.pl that would be > important for making this a real fix -- such as checking for the necessary > mailer Perl modules. I would suggest to fill afterwards another bug for the checksetup.pl update. > Is there any alternative that would get this into production code? Probably not. Good luck for 3.2 !
Updated•17 years ago
|
Priority: P3 → P1
hrm, looks like Email::Send as of at least 2.185 supports smtp auth ( by using Net::SMTP ) http://search.cpan.org/~rjbs/Email-Send-2.185/lib/Email/Send/SMTP.pm shouldn't be too hard to add a "smtpauthuser" and "smtpauthpass" to pass down when calling Email::Send::send()
Comment 10•16 years ago
|
||
Bugzilla 3.2 is now frozen. Only enhancements blocking 3.2 or specifically approved for 3.2 may be checked in to the 3.2 branch. If you would like to nominate your enhancement for Bugzilla 3.2, set the "blocking3.2" flag to "?", and either the target milestone will be changed back, or the blocking3.2 flag will be granted, if we will accept this enhancement for Bugzilla 3.2.
Target Milestone: Bugzilla 3.2 → Bugzilla 4.0
Comment 11•16 years ago
|
||
This doesn't even have a patch or an assignee, so it isn't something we can take on the branch.
Flags: blocking3.2? → blocking3.2-
Assignee | ||
Comment 12•16 years ago
|
||
There has been so many requests to support SMTP auth that I decided to fix it myself. Looking at the doc about Net::SMTP and Email::Send::SMTP, it seems as simple as that. I have no way to test my patch, so I will let the reviewer do it for me.
Assignee: email-notifications → LpSolit
Status: NEW → ASSIGNED
Attachment #308415 -
Flags: review?(justdave)
Comment 13•16 years ago
|
||
Comment on attachment 308415 [details] [diff] [review] patch, v1 r=Wurblzap by inspection. Code is ok, testing is still needed.
Attachment #308415 -
Flags: review+
Comment 14•16 years ago
|
||
Comment on attachment 308415 [details] [diff] [review] patch, v1 >Index: Bugzilla/Mailer.pm >+ username => Bugzilla->params->{"smtp_username"}, >+ password => Bugzilla->params->{"smtp_password"}, I'm a bit concerned what would happen here with SMTP servers that don't support authentication. I think these parameters should only be passed if they are not empty. >+ { >+ name => 'smtp_password', >+ type => 't', >+ default => '' >+ }, I'd really like to make that a password box, if possible. >Index: template/en/default/admin/params/mta.html.tmpl >+ smtp_username => "The username to pass to the SMTP server for SASL authentication. " _ >+ "Leave this field empty if your SMTP server doesn't require authentication.", Don't use the term "SASL authentication" as most administrators won't know what that is. You can just say "SMTP authentication" instead.
Assignee | ||
Comment 15•16 years ago
|
||
Fixing mkanat's comments. About the username and password, $smtp->auth() is only called if the username is not empty, so that's fine.
Attachment #308415 -
Attachment is obsolete: true
Attachment #308756 -
Flags: review?(justdave)
Attachment #308415 -
Flags: review?(justdave)
Comment 16•16 years ago
|
||
Comment on attachment 308756 [details] [diff] [review] patch, v2 This looks fine to me.
Attachment #308756 -
Flags: review?(justdave) → review+
Assignee | ||
Comment 17•16 years ago
|
||
OK, I tested my patch with smtp.aim.com (I forgot I had access to it) and it's working fine: Net::SMTP=GLOB(0x9ee9fdc)<<< 235 AUTHENTICATION SUCCESSFUL ... Net::SMTP=GLOB(0x9ee9fdc)<<< 250 OK And I correctly got the bugmail in my mailbox. With the smtp_username and smtp_password fields left empty, or without my patch applied, I get in both cases: Net::SMTP=GLOB(0x9acf47c)<<< 556 CLIENT AUTHENTICATION REQUIRED. USE ESMTP EHLO AND AUTH. Net::SMTP=GLOB(0x9acf47c)<<< 503 BAD SEQUENCE OF COMMANDS So it seems to work fine. Approving for 3.2, per discussion with mkanat on IRC.
Flags: approval+
Whiteboard: [roadmap: 4.0]
Target Milestone: Bugzilla 4.0 → Bugzilla 3.2
Assignee | ||
Comment 18•16 years ago
|
||
Just on time for Bugzilla 3.1.4. :) Checking in Bugzilla/Mailer.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Mailer.pm,v <-- Mailer.pm new revision: 1.18; previous revision: 1.17 done Checking in Bugzilla/Config/Common.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Config/Common.pm,v <-- Common.pm new revision: 1.20; previous revision: 1.19 done Checking in Bugzilla/Config/MTA.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Config/MTA.pm,v <-- MTA.pm new revision: 1.16; previous revision: 1.15 done Checking in Bugzilla/Install/Requirements.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Install/Requirements.pm,v <-- Requirements.pm new revision: 1.43; previous revision: 1.42 done Checking in template/en/default/admin/params/common.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/params/common.html.tmpl,v <-- common.html.tmpl new revision: 1.6; previous revision: 1.5 done Checking in template/en/default/admin/params/mta.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/params/mta.html.tmpl,v <-- mta.html.tmpl new revision: 1.12; previous revision: 1.11 done
Comment 20•16 years ago
|
||
Added to the release notes for Bugzilla 3.2 in a patch on bug 432331.
Keywords: relnote
Comment 21•16 years ago
|
||
Bugzilla 3.04 stops working after applying this patch! Here is da Log: Can't locate Bugzilla/Install/Requirements.pm in @INC (@INC contains: . /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl) at Bugzilla/Version.pm line 24. BEGIN failed--compilation aborted at Bugzilla/Version.pm line 24. Compilation failed in require at Bugzilla/Product.pm line 21. BEGIN failed--compilation aborted at Bugzilla/Product.pm line 21. Compilation failed in require at Bugzilla/User.pm line 48. BEGIN failed--compilation aborted at Bugzilla/User.pm line 48. Compilation failed in require at Bugzilla/Auth/Verify.pm line 24. BEGIN failed--compilation aborted at Bugzilla/Auth/Verify.pm line 24. Compilation failed in require at (eval 14) line 3. ...propagated at /usr/share/perl/5.8/base.pm line 84. BEGIN failed--compilation aborted at Bugzilla/Auth/Verify/Stack.pm line 19. Compilation failed in require at Bugzilla/Auth.pm line 36. BEGIN failed--compilation aborted at Bugzilla/Auth.pm line 36. Compilation failed in require at Bugzilla.pm line 31. BEGIN failed--compilation aborted at Bugzilla.pm line 31. Compilation failed in require at /var/www/editparams.cgi line 28. BEGIN failed--compilation aborted at /var/www/editparams.cgi line 28. Can't locate Bugzilla/Install/Requirements.pm in @INC (@INC contains: . /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl) at Bugzilla/Version.pm line 24. BEGIN failed--compilation aborted at Bugzilla/Version.pm line 24. Compilation failed in require at Bugzilla/Product.pm line 21. BEGIN failed--compilation aborted at Bugzilla/Product.pm line 21. Compilation failed in require at Bugzilla/User.pm line 48. BEGIN failed--compilation aborted at Bugzilla/User.pm line 48. Compilation failed in require at Bugzilla/Auth/Verify.pm line 24. BEGIN failed--compilation aborted at Bugzilla/Auth/Verify.pm line 24. Compilation failed in require at (eval 14) line 3. ...propagated at /usr/share/perl/5.8/base.pm line 84. BEGIN failed--compilation aborted at Bugzilla/Auth/Verify/Stack.pm line 19. Compilation failed in require at Bugzilla/Auth.pm line 36. BEGIN failed--compilation aborted at Bugzilla/Auth.pm line 36. Compilation failed in require at Bugzilla.pm line 31. BEGIN failed--compilation aborted at Bugzilla.pm line 31. Compilation failed in require at /var/www/editparams.cgi line 28. BEGIN failed--compilation aborted at /var/www/editparams.cgi line 28. Can't locate Bugzilla/Install/Requirements.pm in @INC (@INC contains: . /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl) at Bugzilla/Version.pm line 24. BEGIN failed--compilation aborted at Bugzilla/Version.pm line 24. Compilation failed in require at Bugzilla/Product.pm line 21. BEGIN failed--compilation aborted at Bugzilla/Product.pm line 21. Compilation failed in require at Bugzilla/User.pm line 48. BEGIN failed--compilation aborted at Bugzilla/User.pm line 48. Compilation failed in require at Bugzilla/Auth/Verify.pm line 24. BEGIN failed--compilation aborted at Bugzilla/Auth/Verify.pm line 24. Compilation failed in require at (eval 14) line 3. ...propagated at /usr/share/perl/5.8/base.pm line 84. BEGIN failed--compilation aborted at Bugzilla/Auth/Verify/Stack.pm line 19. Compilation failed in require at Bugzilla/Auth.pm line 36. BEGIN failed--compilation aborted at Bugzilla/Auth.pm line 36. Compilation failed in require at Bugzilla.pm line 31. BEGIN failed--compilation aborted at Bugzilla.pm line 31. Compilation failed in require at /var/www/index.cgi line 34. BEGIN failed--compilation aborted at /var/www/index.cgi line 34. Can't locate Bugzilla/Install/Requirements.pm in @INC (@INC contains: . /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl) at Bugzilla/Version.pm line 24. BEGIN failed--compilation aborted at Bugzilla/Version.pm line 24. Compilation failed in require at Bugzilla/Product.pm line 21. BEGIN failed--compilation aborted at Bugzilla/Product.pm line 21. Compilation failed in require at Bugzilla/User.pm line 48. BEGIN failed--compilation aborted at Bugzilla/User.pm line 48. Compilation failed in require at Bugzilla/Auth/Verify.pm line 24. BEGIN failed--compilation aborted at Bugzilla/Auth/Verify.pm line 24. Compilation failed in require at (eval 14) line 3. ...propagated at /usr/share/perl/5.8/base.pm line 84. BEGIN failed--compilation aborted at Bugzilla/Auth/Verify/Stack.pm line 19. Compilation failed in require at Bugzilla/Auth.pm line 36. BEGIN failed--compilation aborted at Bugzilla/Auth.pm line 36. Compilation failed in require at Bugzilla.pm line 31. BEGIN failed--compilation aborted at Bugzilla.pm line 31. Compilation failed in require at /var/www/index.cgi line 34. BEGIN failed--compilation aborted at /var/www/index.cgi line 34.
Assignee | ||
Comment 22•16 years ago
|
||
(In reply to comment #21) > Bugzilla 3.04 stops working after applying this patch! Here is da Log: Unrelated to this patch. You didn't run checksetup.pl after applying the patch, that's why.
Comment 23•16 years ago
|
||
(In reply to comment #22) > (In reply to comment #21) > > Bugzilla 3.04 stops working after applying this patch! Here is da Log: > > Unrelated to this patch. You didn't run checksetup.pl after applying the patch, > that's why. > wrong, checksetup.pl fails woth several errors after the patch ... this hack pretty **** up my bugzilla, i had to reinstall everything . it worked perfectly before that
Comment 24•16 years ago
|
||
additionally, even patch -p0 fails ... well what a erroneous piece of software-****, huh. Well i solved my SMTP-AUTH-problem pretty easy: use Exim as Smarthost-Relay :-). Bye
Assignee | ||
Comment 25•16 years ago
|
||
(In reply to comment #23) > wrong, checksetup.pl fails woth several errors after the patch ... this hack > pretty fucked up my bugzilla (In reply to comment #24) > additionally, even patch -p0 fails ... well what a erroneous piece of > software-shit OK, before complaining that the patch is buggy, start reading the target milestone of this bug, and you will notice that it indicates "Bugzilla 3.2", meaning that the patch doesn't apply to 3.0.4. Now if it messed up your installation, that's not our fault, but yours. Bye.
You need to log in
before you can comment on or make changes to this bug.
Description
•