Nevermind. I am an idiot. This one of those time where you spend 6 hours trying to debug something that ends up being ease fix.
If you have a similar problem, make sure your sendmail configuration is ok.
time echo test | sendmail [email protected]
real 1m0.170s
user 0m0.008s
sys 0m0.004s
127.0.0.1 localhost.localdomain localhost yourhostname
The bold section needs to be changed with your personal host name. You can find it by typing in console
$ hostname
Then you will know how to make it correct.