nigong
nigong

Reputation: 1755

CI - Xcode 9 Server doesn't send email after integration

I was able to setup Server & Bots with Xcode 9 (ref). The integration can be run smoothly. However, the expected email report is never sent.

I've already setup my Mac to send emails using postfix. For example, I can run this command and then receive the email:

$ date | mail -s test1 [email protected]

To make Xcode send email, I have done the following setups: enter image description here enter image description here

However, no email is sent or received. I wonder if there is any additional setup is needed.

Any help is appreciated. Many thanks!

Upvotes: 3

Views: 1007

Answers (1)

Darko
Darko

Reputation: 9845

After 20 hours searching I finally found the problem. I will try to describe the needed steps to get this working:

  1. On your CI server the postfix SMTP server needs to be configured and working. There are multiple tutorials on the internet. The one I used was this one:

https://blog.anupamsg.me/2012/02/14/enabling-postfix-for-outbound-relay-via-gmail-on-os-x-lion-11/

However, I still was not able to sent a mail with the mail command after I configured everything like explained in the tutorial.

  1. The missing piece was the Gmail setting for "less secure apps". Gmail does not allow sending emails over their SMTP even if login and password are correct. The SMTP server needs to fulfill special requirements. (which I am not aware of...) However, it is possible to losen that restriction and allow access from any SMTP. Here:

https://support.google.com/accounts/answer/6010255

enter image description here

Set "Allow less secure apps" to On. I recommend creating a dedicated Gmail account just for this and not to enable this setting on your day-to-day email account.

Now everything was working and I was able to successfully send mails with the macOS cli command mail.

  1. The last step needed to solve this was to setup the Xcode server settings correctly. (and this is what basically answers OP's question). So, the correct setup (after mail cli works) was to not set any settings in Xcode server. Just remove all the settings, then Xcode server will fall back to postfix.

enter image description here

Just remove all settings, that's it. Now Xcode CI server sends successfully emails.

Upvotes: 1

Related Questions