Not being able to send mail! 401 error


#1

i did ./bin/mail send-test --to my email --trace

>>> [11] <query> UPDATE `metamta_mail` SET `actorPHID` = NULL, `parameters` = '{\"sensitive\":true,\"cc\":[],\"subject\":\"No Subject\",\"body\":\"\",\"is-bulk\":false,\"mailtags\":[],\"raw-to\":[\"myemail@mail.com\"],\"headers.sent\":[[\"X-Phabricator-Sent-This-Message\",\"Yes\"],[\"X-Mail-Transport-Agent\",\"MetaMTA\"],[\"X-Auto-Response-Suppress\",\"All\"]],\"actors.sent\":[],\"routing.sent\":null,\"routingmap.sent\":[]}', `status` = 'queued', `message` = '[HTTP/401] \nForbidden\n#0 /var/www/html/phabricator/libph
<<< [11] <query> 11,478 us
[2017-10-04 14:14:41] EXCEPTION: (HTTPFutureHTTPResponseStatus) [HTTP/401] 
Forbidden at [<phutil>/src/future/http/BaseHTTPFuture.php:339]
arcanist(head=master, ref.master=c804c5026011), phabricator(head=master, ref.master=3e589cdd73ba), phutil(head=master, ref.master=9f9c33797a3e)
  #0 BaseHTTPFuture::parseRawHTTPResponse(string) called at [<phutil>/src/future/http/HTTPSFuture.php:418]
  #1 HTTPSFuture::isReady() called at [<phutil>/src/future/Future.php:37]
  #2 Future::resolve() called at [<phutil>/src/future/http/BaseHTTPFuture.php:279]
  #3 BaseHTTPFuture::resolvex() called at [<phabricator>/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php:121]
  #4 PhabricatorMailImplementationMailgunAdapter::send() called at [<phabricator>/src/applications/metamta/storage/PhabricatorMetaMTAMail.php:671]
  #5 PhabricatorMetaMTAMail::sendNow() called at [<phabricator>/src/applications/metamta/PhabricatorMetaMTAWorker.php:22]
  #6 PhabricatorMetaMTAWorker::doWork() called at [<phabricator>/src/infrastructure/daemon/workers/PhabricatorWorker.php:123]
  #7 PhabricatorWorker::executeTask() called at [<phabricator>/src/infrastructure/daemon/workers/PhabricatorWorker.php:162]
  #8 PhabricatorWorker::scheduleTask(string, integer, array) called at [<phabricator>/src/applications/metamta/storage/PhabricatorMetaMTAMail.php:383]
  #9 PhabricatorMetaMTAMail::save() called at [<phabricator>/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php:173]
  #10 PhabricatorMailManagementSendTestWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:441]
  #11 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:333]
  #12 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/scripts/mail/manage_mail.php:21]

I did some more digging and i found this

ID: 15
Status: queued
Related PHID: PHID-CONP-ozhtl3xy7abyzq7imumz
Message: [HTTP/401]
Forbidden
#0 /var/www/html/phabricator/libphutil/src/future/http/HTTPSFuture.php(418): BaseHTTPFuture->parseRawHTTPResponse('HTTP/1.1 401 UN...')
#1 /var/www/html/phabricator/libphutil/src/future/Future.php(37): HTTPSFuture->isReady()
#2 /var/www/html/phabricator/libphutil/src/future/http/BaseHTTPFuture.php(279): Future->resolve()
#3 /var/www/html/phabricator/phabricator/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php(121): BaseHTTPFuture->resolvex()
#4 /var/www/html/phabricator/phabricator/src/applications/metamta/storage/PhabricatorMetaMTAMail.php(671): PhabricatorMailImplementationMailgunAdapter->send()
#5 /var/www/html/phabricator/phabricator/src/applications/metamta/PhabricatorMetaMTAWorker.php(22): PhabricatorMetaMTAMail->sendNow()
#6 /var/www/html/phabricator/phabricator/src/infrastructure/daemon/workers/PhabricatorWorker.php(123): PhabricatorMetaMTAWorker->doWork()
#7 /var/www/html/phabricator/phabricator/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php(171): PhabricatorWorker->executeTask()
#8 /var/www/html/phabricator/phabricator/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php(22): PhabricatorWorkerActiveTask->executeTask()
#9 /var/www/html/phabricator/libphutil/src/daemon/PhutilDaemon.php(219): PhabricatorTaskmasterDaemon->run()
#10 /var/www/html/phabricator/libphutil/scripts/daemon/exec/exec_daemon.php(131): PhutilDaemon->execute()
#11 {main}

but i still don’t know why it is doing it.


#2

It looks like you’re using Mailgun as your MTA. Did you set up your domain in Mailgun and put the right domain and API key into /config/group/mailgun/?