[api] add threading support for build failure mails

And enable actual sendmail