Exception when sending email

Issue #25 wontfix
J Grimmtooth created an issue

Version: 4.0.1 BitBucket Version: 4.8.3

Set addon up to send an email whenever a push happens. Select all defaults. Execute push, and this appears in atlassian-bitbucket-mail.log :

2016-11-15 12:21:51,798 ERROR [mail-sender:thread-1] JeffreyG3 @TQBTH5x741x1387655x3 10.69.14.53 "POST /scm/rddem/stig3.git/git-receive-pack HTTP/1.1" bitbucket.mail-log Mail sending failed. Please verify the mail server configuration and check the logs for details; recipient: jeffreyg3@verifone.com; subject: [3ef9996@refs/heads/bugfix/gt-1934] * GT-1934 - Test email notification (5)
org.springframework.mail.MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.1 Client does not have permissions to send as this sender

        at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:474) ~[spring-context-support-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345) ~[spring-context-support-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:362) ~[spring-context-support-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:350) ~[spring-context-support-4.2.5.RELEASE.jar:4.2.5.RELEASE]
        at com.atlassian.stash.internal.mail.MailServiceImpl.sendMessageSynchronously(MailServiceImpl.java:207) [bitbucket-service-impl-4.8.3.jar:na]
        at com.atlassian.stash.internal.mail.MailServiceImpl.sendNow(MailServiceImpl.java:172) [bitbucket-service-impl-4.8.3.jar:na]
        at com.atlassian.stash.internal.mail.MailServiceImpl$2.run(MailServiceImpl.java:138) [bitbucket-service-impl-4.8.3.jar:na]
        at com.atlassian.stash.internal.concurrent.StateTransferringExecutor$StateTransferringRunnable.run(StateTransferringExecutor.java:70) [bitbucket-platform-4.8.3.jar:na]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_60]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
        ... 1 frame trimmed

The email does not actually get sent.

Note that I can generate test emails from the email server config for BitBucket, and Pull Request emails are getting out with no error.

Comments (5)

  1. Marc Vanbrabant repo owner

    @grimmtooth this is not an issue in this project. I assume that your smtp server (gmail?) is not validated as a valid "from". You can configure the from in the settings of the hook.

    Possibly your "from" is not allowed by your SMTP server. But again, this is nothing I can change, you'll have to figure out why your SMTP is throwing you the 550 5.7.1.

  2. J Grimmtooth reporter

    So can you tell me which parameter you're using in the Stash email config? There is a User + PW field, and an "email from" field, in the Bitbucket mail settings config. What our IT is telling us is that it is rejecting the email because there is a mismatch on who the email is being sent on behalf of, versus who it's actually being sent from.

    Right now we have i_grdtoolsadmin@verifone.com configured for the "email from" field. That is apparently not being used. If I go into the hook config for the repository, and override the default with that very email, everything works fine.

    So we have a workaround. But this amounts to our repo owners having to override the "email from" for every repo that wishes to use this feature.

    If there was a global config for the addon that we could tweak, that would solve the problem, at least from what I can tell without having access to both ends of the pipe.

  3. Marc Vanbrabant repo owner

    @grimmtooth I am sorry that is not working out for you. By default the "From" can only be configured by overriding the "email from" per repository.

    There is already an issue open (#10) to address global configs. At the moment there is no other workarounds.

    Note that the reasoning behind is that a different "email from" per repository is useful for creating email rules. Which is why each "email from" defaults to: https://bitbucket.org/slyoldfox/notifier/src/c77fa13a33e9c3f601d46d05d8f8a112dc1bb06b/src/main/resources/templates/notifyemailfrom.vm?at=master&fileviewer=file-view-default

  4. J Grimmtooth reporter

    I've added myself to the watchers for that ticket and will be watching with great interest :)

    We've documented the workaround for now, but I KNOW I'm gonna catch grief from our engineers. Won't be the first, or the last time, I'm sure :) If it gets bad enough I'll talk the boss into getting our java guy to haxxor a local fork and hardcode the thing.

    Thanks for the comeback and explanation.

  5. Log in to comment