'Phabricator not sending outbound emails

I have set up my outbound emails on phabricator by following this guide.

However, my emails don't arrive. All the emails are queued. When I went to the daemons in Phabricator UI, I see that several tasks are failing. They all look like this.

Task 448: PhabricatorMetaMTAWorker  
Task 448    
Task StatusQueuedTask ClassPhabricatorMetaMTAWorkerLease StatusLeasedLease Owner13195:1624502950:mail.icicbcoin.com:11Lease Expires1 h, 59 mDurationNot Completed 
Data phabricator/ $ ./bin/mail show-outbound --id 154
    Retries 
    Failure Count5Maximum Retries250Retries After1 m, 2 m, 4 m, 6 m, 8 m, 11 m, 14 m, 17 m, 20 m, 23 m, 27 m, ...

I'm curious of this data part. To me it sounds like phabricator fails running this command which is weir because if I run ./bin/mail show-outbound --id 154 manually I get this:

ID: 154
Status: queued
Related PHID: 
Message: fputs(): send of 28 bytes failed with errno=32 Broken pipe

 PARAMETERS 
sensitive: 1
mustEncrypt: 
subject: [Phabricator] Welcome to Phabricator
to: ["PHID-USER-qezqlvc7rxton2lshjue"]
force: 1

 HEADERS 

 TEXT BODY 
Welcome to Phabricator!

admin (John Doe) has created an account for you.

    Username: some.person

To log in to Phabricator, follow this link and set a password:

  http://phabricator.innolabsolutions.rs/login/once/welcome/9/b2jf7j6mg5xomwjhmcfcxbigs7474jyq/10/

After you have set a password, you can log in to Phabricator in the future by going here:

  http://phabricator.innolabsolutions.rs/

Love,
Phabricator

 HTML BODY 
(This message has no HTML body.)


Solution 1:[1]

Actually, the problem was the SMTP server configuration, even though this error didn't tell me that. I changed the SMTP port from 465 to 587, restarted the daemons and it worked.

Solution 2:[2]

I had the same problem twice. The second time, it was because I could not resolve the smtp server name:

$ ping gandi.net
ping: gandi.net: Temporary failure in name resolution

Then I added a dns server in /etc/resolv.conf

nameserver 127.0.0.1
nameserver 8.8.8.8 # <--- added
search home

and restarted the service

sudo service systemd-resolved restart

Right after, Phabricator automatically sent all the queued emails.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3362334
Solution 2 PJ127