Bugzilla alerts using GMail

This article explains how to use GMAIL SMTP(TLS AUTH) to send bugzilla alerts.

Bugzilla supports following methods to send mail alerts :

  • sendmail
  • SMTP

For SMTP method BugZilla uses Email::Send::SMTP Perl module. GMAIL SMTP uses TLS ( Transport Layer Security ) as authentication method, so Email::Send::SMTP can not be used for the same.

We need to use another perl module Email::Send::SMTP::TLS.
First step would be to install Email::Send::SMTP::TLS from CPAN. use following steps to do so :

using CPAN shell

Lanch CPAN shell as follows

and then on CPAN Shell execute following command

cpan shell might ask you to install additional modules, install them.

compiling from source
Download source from HERE and execute following commands

 

NOTE: If you are facing issues in installing Email::Send::SMTP::TLS module on Microsoft Windows, please follow this thread http://serverfault.com/questions/83113/bugzilla-mail-delivery-method-using-tls-for-gmail

 

Once Email:Send::SMTP::TLS is installed, BugZilla should have SMTP::TLS method to send alerts. This can be verified by logging in as admin to BugZilla and going to Administration -> Parameters -> Email

bugzilla_tls_method

Now we need tweak BugZilla code. carefully execute following instructions and don’t forget to backup files before you modify.
Go to your BugZilla installation directory and execute following command

Open Mailer.pm file.

Add following line after last ‘use’ statment

Search for following code

add following line after it

search for following if block

and change it to

Now we need to do settings in bugzilla parameters.
Login as administrator to Bugzilla and go to Administration -> Parameters -> Email and do following settings

  1. Select SMTP::TLS as mail_delivery_methodbugzilla_tls_method-300x162
  2. Enter your gmail address in mailfrom

    bugzilla_tls_mail_from

  3.  Enter smtp.gmail.com:587 in smtpserverbugzilla_tls_smtpserver
  4.  Enter you@gmail.com in smtp_usernamebugzilla_tls_smtpuser
  5. Enter gmail password in smtp_passwordbugzilla_tls_smtppass
  6. Click on save changes

 

22 thoughts on “Bugzilla alerts using GMail

  1. aparna says:

    It was very useful.. finally able to crack after two full days 🙂

  2. feige says:

    This is just wonderful, thanks.

  3. mnomkar2008 says:

    cpan> install Email::Send::SMTP::TLS

    This failed due to some (may be Email::Abstract) dependency was not installed.

    But I downloaded the gz file from :

    http://search.cpan.org/~fayland/Email-Send-SMTP-TLS-0.04/lib/Email/Send/SMTP/TLS.pm

    and then I installed TLS from the source :
    # perl Makefile.pl
    # make
    # make install

    Got the Email::Send::SMTP::TLS installed and follwed the changes to “bugzilla-XX/Bugzilla/Mailer.pl” as in this blog.

    • mnomkar2008 says:

      Use tar command to unzip th file :

      $ tar -xvf Email-Send-SMTP-TLS-0.04.tar.gz

      Then enter into it:

      $ cd Email-Send-SMTP-TLS-0.04

      Then run the above commands… perl Makefile.pl

      Nice blog Thank you

  4. Shahir says:

    After many hours of searching, I found this blog. Excellent!

  5. Thirpu says:

    Cant able to download source file

    tar zxvf Email-Send-SMTP-TLS-0.03.tar.gz
    cd Email-Send-SMTP-TLS-0.03
    ./configure
    make
    make install

    Not found error, can you please help me in downloading

  6. Svend says:

    Hi
    Thanks for the help here.
    When I try this, no new delivery methods show up in the configuration page?

    Any Idea why tha is ?

    svend

  7. ranjith says:

    Dawood,
    followed the above method but still mail is not receiving in gmail. Bugzilla showing bugs added to the database and mail successfully send to abc@gmail.com.
    any idea .. waiting for your reply..
    Thanks in advance
    Ranjith.

    • Raja Kadali says:

      hey, I’m also getting the same issue, bugs posted succesfully, and mail sent succesfully, but the mail doesnt actually sent.
      did you solve this issue?
      please post the solution.

  8. Colby says:

    Huge thanks, this fixed my issues with sending mail through Amazon SES (SMTP w/TLS)

  9. Rakesh says:

    Hi Dawood,

    Your article was useful in understanding the usage of gmail through perl. I am setting up bugzilla on localhost, however i am unable to configure the bugzilla to use gmail.

    Even after using method specified above, I am getting authentication failure, (debug enabled on bugzilla). Though I am able to login to gmail directly using browser with same password. DO I need to enable gmail as POP or IMAP ? Your inputs will be helpful.

    Waiting for your reply

  10. Loganathan says:

    I got the following error

    Software error:

    Connect failed :IO::Socket::INET: connect: Permission denied
    at /usr/local/share/perl5/Email/Send/SMTP/TLS.pm line 45

  11. krishan says:

    Hi,

    I am trying to setup bugzilla 5.0 for Windows. Not able to get SMTP::TLS in drop-down option list.

    I followed all the steps but replace the if block
    ‘if ($method eq “SMTP”) {‘ with the one given here but it is causing other errors like @args undfined, etc.

    The existing code in mailer.pm is

    if ($method eq “SMTP”) {
    my ($host, $port) = split(/:/, Bugzilla->params->{‘smtpserver’}, 2);
    $transport = Bugzilla->request_cache->{smtp} //=
    Email::Sender::Transport::SMTP::Persistent->new({
    host => $host,
    defined($port) ? (port => $port) : (),
    sasl_username => Bugzilla->params->{‘smtp_username’},
    sasl_password => Bugzilla->params->{‘smtp_password’},
    helo => $hostname,
    ssl => Bugzilla->params->{‘smtp_ssl’},
    debug => Bugzilla->params->{‘smtp_debug’} });
    }

    Could you please suggest appropriate steps / replacement code for Bugzilla 5.0 Mailer.pm?

    Best

    • pinghsien422 says:

      I had the same problem with v5.0. Unable to resolve this issue after a long time, I settled by installing v4.4.10 of bugzilla, and problem went away.

    • Joe says:

      I’m having the same problems in Bugzilla 5. SMTP:TLS doesn’t show up in the dropdown. I did put use Email::Send::SMTP::TLS in Mailer.pm. But it’s not doing anything different as far as I can tell. It looks like it’s doing EHLO, and then it tries to do AUTH, and that fails of course. Any suggestions would be much appreciated.

  12. pinghsien422 says:

    Thanks for the post, however, after installing the TLS package (via cpanm), the SMTP::TLS option does not appear. And when I proceed to make the code change in Mailer.pm, I get the following error output:

    Software error:

    Global symbol “@args” requires explicit package name at Bugzilla/Mailer.pm line 138.
    Global symbol “@args” requires explicit package name at Bugzilla/Mailer.pm line 144.
    Compilation failed in require at Bugzilla/Auth.pm line 22.
    BEGIN failed–compilation aborted at Bugzilla/Auth.pm line 22.
    Compilation failed in require at Bugzilla.pm line 23.
    BEGIN failed–compilation aborted at Bugzilla.pm line 23.
    Compilation failed in require at /srv/www/bugzilla/editparams.cgi line 15.
    BEGIN failed–compilation aborted at /srv/www/bugzilla/editparams.cgi line 15.
    For help, please send mail to this site’s webmaster, giving this error message and the time and date of the error.

    Any idea why?

  13. Lars says:

    As for Bugzilla 5.0: follow the blog, do not wonder that SMTP::TLS will not appear. It works when selecting SMTP.
    use ‘push my @args’,… to resolve the ‘explicit package name’ issue.
    I think this should be contributed back into Bugzilla quickly. Does anyone want the SMTP::TLS issue? Is there anyone expecting something like that to appear?
    Anyone to claim this for Bugzilla 5.0? Please go ahead. Thanks!

    I switched ssl_smtp parameter in the admin panel (section eMail) to -> on
    ———–
    if ($method eq “SMTP” || $method eq “SMTP::TLS”) {
    ($smtp_server,$smtp_port) = split /:/,Bugzilla->params->{“smtpserver”};
    push my @args,
    Host => $smtp_server,
    User => Bugzilla->params->{“smtp_username”},
    Password => Bugzilla->params->{“smtp_password”},
    Hello => $hostname,
    Debug => Bugzilla->params->{‘smtp_debug’};
    push my @args, Port => $smtp_port if($smtp_port);
    }

  14. subodh says:

    I am not getting option in bugzilla mail configuration after installing Email::Send::SMTP::TLS.
    please send me the full steps

  15. Hugo Lara says:

    After the execution of perl -MCPAN -e shell and cpan> install Email::Send::SMTP::TLS still doesnt appears the SMTP::TLS option in Parameters-Email , can someone help me? my version of bugzilla is 4.4.2 and the perl version is 5.14. Best regards

  16. Ankit says:

    It says
    Auth failed: 534 5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbtU
    at /usr/local/lib/perl5/site_perl/5.8.8/Email/Send/SMTP/TLS.pm line 45.

Leave a Reply

Your email address will not be published. Required fields are marked *