Open Bug 1445823 Opened 7 years ago Updated 3 years ago

office 365 SMTP issue -> failed AUTH: Command unknown: 'AUTH'

Categories

(Bugzilla :: Email Notifications, defect)

5.0.3
defect
Not set
normal

Tracking

()

UNCONFIRMED

People

(Reporter: silergy.bugzilla, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36 Steps to reproduce: I am using Bugzilla version 5.0.4. Setting SMTP as given at http://bugzilla.readthedocs.io/en/latest/installing/essential-post-install-config.html#use-another-mail-server Setting at administration->parameters->email: smtpserver : ip address with port for the office 365 SMTP server (valid) smtp_username : a valid user id smtp_password : valid password for the user id smtp_ssl : off Update or log any bug, I get an error as: There was an error sending mail from 'abc1234@abc.com' to 'abc15678@abc.com': failed AUTH: Command unknown: 'AUTH' I tried with smtp_ssl : on as well. In that case, I get following error: There was an error sending mail from 'abc1234@abc.com' to 'abc15678@abc.com': unable to establish SMTP connection to <<smtp_ip>> port <<smtp_port>> Actual results: When I use Gmail configuration as given at http://bugzilla.readthedocs.io/en/latest/installing/essential-post-install-config.html#gmail I don't get the error and email go through. So, please share how to set office 365 SMTP with Bugzilla 5.0.4.

set
smtp_ssl:on

then edit Mailer.pm and in the if($method eq "SMTP") you should replace:

ssl => Bugzilla->params->{'smtp_ssl'},

with

$port eq "587" ? (ssl => "starttls") : (ssl => Bugzilla->params->{'smtp_ssl'}),

Sending mails using Microsoft 365 fails probably due to STARTTLS.
SMTP information from Microsoft, source: https://support.microsoft.com/en-us/office/pop-imap-and-smtp-settings-8361e398-8af4-4e97-b147-6c6c4ac95353

  • SMTP hostname: smtp.office365.com
  • Port: 587
  • Encryption: STARTTLS

I confirm that the suggested change fixes the mail problem for me.
To be more precise, this is the file I changed.

/srv/http/bugzilla/Bugzilla/Mailer.pm

This has been the result after the replace, where the old ssl line has been commented out.

  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'},
      $port eq "587" ? (ssl => "starttls") : (ssl => Bugzilla->params->{'smtp_ssl'}),
      debug         => Bugzilla->params->{'smtp_debug'}
      });
  }

If this is the correct fix, then it would be nice to have this included in the next Bugzilla release.

You need to log in before you can comment on or make changes to this bug.