I am running Xcode Server Bots on my local iMac but the email notifications are not being sent.
I have followed many tutorials and have postfix setup and working. I can successfully send emails using the command
sudo echo "Test sending email from Postfix" | mail -s "Test Postfix" [email protected]
and my email is received.
Under Xcode > Preferences > Server & Bots > Mail I have left everything blank as per all the tutorials.
For my Bot, under Triggers I have a Periodic Email Report with Schedule set to After each integration and set my from, reply-to and To fields and have every Notify On ticked.
I monitor the smtp and smtp process using the command
sudo log stream --predicate '(process == "smtpd") || (process == "smtp")' --info
and when I send an email using the above test, I get a log line showing.
However when my Xcode Bot completes, I get absolutely nothing. The Bot logs show
Feb 2 13:47:16 [596] <Info>: Executing trigger 'Periodic Email Report'
Feb 2 13:47:16 [596] <Info>: Executing trigger 'New Issue Email'
So the email report is not triggering any kind of smtp. Is it even using postfix? Can I log something else to see whether it is hitting postfix at all?
EDIT ------
I have found some sendmail logs that seem to show Xcode doesn't have the right permission to use postdrop:
kernel Sandbox: sendmail(48548) deny(1) forbidden-exec-sugid
sendmail fatal: execvp /usr/sbin/postdrop: Operation not permitted
sendmail warning: command "/usr/sbin/postdrop -r" exited with status 1
sendmail fatal: xcode@<redacted>.com(450): unable to execute /usr/sbin/postdrop -r: Undefined error: 0
My postdrop permissions seem to be correct compared to what I can find online:
-rwxr-xr-x 1 root wheel 570448 1 Jan 2020 postalias
-rwxr-xr-x 1 root wheel 466416 1 Jan 2020 postcat
-rwxr-xr-x 1 root wheel 823488 1 Jan 2020 postconf
-rwxr-sr-x 1 root _postdrop 588624 1 Jan 2020 postdrop
-rwxr-xr-x 1 root wheel 431904 1 Jan 2020 postfix
-rwxr-xr-x 1 root wheel 432032 1 Jan 2020 postkick
-rwxr-xr-x 1 root wheel 449424 1 Jan 2020 postlock
-rwxr-xr-x 1 root wheel 431872 1 Jan 2020 postlog
-rwxr-xr-x 1 root wheel 569632 1 Jan 2020 postmap
-rwxr-xr-x 1 root wheel 465872 1 Jan 2020 postmulti
-rwxr-sr-x 1 root _postdrop 588448 1 Jan 2020 postqueue
-rwxr-xr-x 1 root wheel 466784 1 Jan 2020 postsuper
I have the _postdrop user in my /etc/group file as:
_postdrop:*:28:
Or am I reading this wrong? Does sendmail user need permission to use postdrop?
EDIT 2 -------
It seems this might be an issue with Big Sur making the root partition read only. sudo postfix set-permissions can't do it's thing.
So I guess the question now is, how to install/use a different method for Xcode Server to send emails?


After a lot of research, asking questions elsewhere and trial and error it seems it's just not going to work. Somewhere along the line, Xcode server doesn't have the right permissions to send email automatically. This could possibly be a bug in Xcode Server, or even Big Sur.
sendmailin itself is quite a beast to setup, but if you have got it working from the command line as suggested in many tutorials, then there is a way you can get emails from Xcode server.After the suggestion from a member on the Apple forums, it seems that using a
Post Integration Scriptyou can in fact callsendmaildirectly. So i've come up with the following scripts:Add this as a Post Integration Script: changing the path to where you save the 2 files below.
email.html
mail.sh Edit the 4 variables as needed. You might need to
chmod +x mail.shthis file.You will now get emails like these:
If anyone knows he we can add the actual failure reasons or errors that would be awesome. There's a list of variables we can use here and I think it might involver looking at the actual build paths.