JIRA reports SMTPSenderFailedException: 501 mail from address must be same as authorization user

I'm using JIRA version 7.2.7, configed with progreSQL.
 
everything went well until I invite other users.
 
admin user is A@mycompany.com, outgoing email is jira@mycompany.com which is not a user of our jira system.
 
I logged in with A@mycompany.com, then goto outgoing setting page, "Send a Test Email" to myself, it succeeded, and I can receive that email.
 
but when I went to "User management", click "Invite users", filled in another email address, click "Invite users". Then the mail will never sent successfully.
and the log said:
 
````
 
    Caused by: com.sun.mail.smtp.SMTPSendFailedException: 501 mail from address must be same as authorization user
    ;
    nested exception is:
        com.sun.mail.smtp.SMTPSenderFailedException: 501 mail from address must be same as authorization user
 
        at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2267)
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1257)
        at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendMimeMessage(SMTPMailServerImpl.java:245)
        at com.atlassian.mail.server.managers.EventAwareSMTPMailServer.sendMimeMessage(EventAwareSMTPMailServer.java:25)
        at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:187)
        ... 26 more
 
````
 
Then I created another user which is "jira@mycompany.com" and logged in with it, and then invite user again, the email got sent.
 
and: we have an old version of jira 6.3.x, which has the same configuration but inviting users works perfectly.
----
 
Any way to fix the problem? why can't we invite users with user logged in other than "jira@mycompany.com"?
 
Thanks very much

1 answer

0 votes

In JIRA try navigating to Cog Icon -> System -> Outgoing mail.  Here are defined the settings for sending mail with JIRA.   I would want to confirm that your "From Address" matches the actual account name being used below in the username for authentication.   If these don't match, then I would expect your SMTP server to get upset and throw this error.  The SMTP server is believing that you might be trying to send messages as user B, but JIRA has the SMTP credentials for user A.

yes, the "From" field is exactly the same as "Username" in "Outgoing Mail" page.

 

it looks like jira always uses the email of current user to send email, rather than uses the configured one. 

I used a docker to set it up: https://hub.docker.com/r/blacklabelops/jira/

 

is that the cause?

I don't know if that docker image has any customizations, but I doubt it.  This specific error we see is generated by your mail server.   This isn't commonly see with JIRA.   What are you using for an outgoing SMTP mail host?  Is this MS Exchange? or Office 365 by chance?

It's possible your mail admin might have a setting on the mail server side or specific to that account that would prevent JIRA from trying to send email from that address with any other user's Full Name other than the one in the system address book.   I can understand why that might exist.  I suppose the thought is to try to help prevent spam, or confusion of what email address is tied to which person sent what message.  This isn't controlled by JIRA though, it's controlled by the mail server settings.   JIRA only has the ability to send from one email address, but it will try to use different JIRA user names to change the displayname to correspond to who triggered that notification.

You could also test this out by trying to use a gmail account for JIRA to send mail with, gmail should be able to do this with JIRA correctly.

I'm sure it is not the problem of mail server.
 
1. use the old jira (6.3.x), with exactly the same setting, inviting users works.
 
2. use current jira (7.2.7), in the "Outgoing Mail" setting page, I can "Send a test email" successfully.
 
3. I wrote another program (in node.js) trying to send email with the same account, i.e. jira@mycompany.com or 'any strings <jira@mycompany.com>', all succeeded
app.use(mailer({
  email: {
    host: 'smtp.exmail.qq.com',
    port: 25,
    secure: false,
    auth: {
      user: 'jiar@mycompany.com',
      pass: 'xxxxxx',
    },
  }, ...
 
4. use current jira (7.2.7), I checked the log, it definitely uses A@mycompany.com, rather than the outgoing email, i.e. jira@mycompany.com, see logs below.
 
 
2017-08-08 07:03:00,778 Sending mailitem To='B@mycompany.com' Subject='You have been invited to use JIRA' From='A@mycompany.com' FromName='A (JIRA)' Cc='null' Bcc='null' ReplyTo='A@mycompan.com' InReplyTo='null' MimeType='text/html' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@177336ff' MessageId='null' ExcludeSubjectPrefix=false' ERROR anonymous    Mail Queue Service [c.a.mail.queue.MailQueueImpl] Error occurred in sending e-mail: To='B@mycompany.com' Subject='You have been invited to use JIRA' From='A@mycompany.com' FromName='A (JIRA)' Cc='null' Bcc='null' ReplyTo='A@mycompan.com' InReplyTo='null' MimeType='text/html' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@55ba749c' MessageId='null' ExcludeSubjectPrefix=false'
com.atlassian.mail.MailException: com.sun.mail.smtp.SMTPSendFailedException: 501 mail from address must be same as authorization user
;
  nested exception is:
        com.sun.mail.smtp.SMTPSenderFailedException: 501 mail from address must be same as authorization user
 
        at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:225)
        at com.atlassian.mail.queue.SingleMailQueueItem.send(SingleMailQueueItem.java:44)
        at com.atlassian.jira.mail.builder.RenderingMailQueueItem.send(RenderingMailQueueItem.java:33)
        at com.atlassian.mail.queue.MailQueueImpl.sendBufferUnderLock(MailQueueImpl.java:103)
        at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:56)
        at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:51)
        at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:48)
        at com.atlassian.jira.util.velocity.DefaultVelocityRequestContextFactory.runWithStaticBaseUrl(DefaultVelocityRequestContextFactory.java:110)
        at com.atlassian.jira.util.DefaultBaseUrl.runWithStaticBaseUrl(DefaultBaseUrl.java:50)
        at com.atlassian.jira.mail.JiraMailQueue.sendBuffer(JiraMailQueue.java:48)
        at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:21)
        at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61)
        at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62)
        at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44)
        at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32)
        at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153)
        at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118)
        at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97)
        at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:443)
        at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJob(CaesiumSchedulerService.java:410)
        at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:388)
        at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:285)
        at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:282)
        at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:65)
        at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:59)
        at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:34)
        at java.lang.Thread.run(Thread.java:748)

It's long time ago this issue. But I know you error:

This is about e-mail issue:

1. You need login in you Tencent Enterprise Account and Edit that e-mail.

2. Deactivate "forced enable secure login"

Try again

 

---

 

这个是因为腾讯企业邮箱强制开启了安全认证

登录腾讯企业邮箱管理员后台

1. 找到这个发件人的账号、编辑

2. 去掉“强制启用安全登录”

再次实验就好了

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

431 views 7 5
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you