Aliyun Can't send email

Submitted by ruo on Fri, 04/14/2017 - 20:26

Based on visitor JING's comment, now we can apply to open 25 via this page:


One of our client running their Magento site in Aliyun HongKong, the site in Aliyun can't send email out.

Tech debug workflow:

1, login Cpanel > Email > Track Delivery.  

The logs show that. all the emails send to this server are success, and send to other domains shows connect time out.  it should be some internet issues of problem.

2, to make sure, we login SSH and directly send the email

php -r "mail('[email protected]', 'test subject', 'test body', 'From: Andre Matos ');"

no error output, go back to  Cpanel > Email > Track Delivery  show that email was error.


use the command

exigrep [email protected] /var/log/exim_mainlog

We get more details, it should can't connect to gmail email server.

3, we can 100% sure it's a internet issue, not the PHP.  

and as we know, the Aliyun always has some strange setting in their server. like their eth0 is the private network IP, not the public IP. their rpm source is use their own server and always lack some import packages.

The solution is 

A edit the


Update the hostname from the private IP to


B edit the


use Google DNS to replace Aliyun's DNS


4. After update the network, We try email again, but still failed.

We think the network should work now, but after input the mail command, some error, no email can send out.  check the email log file, it still said Gmail server can't connected.  

Ping the gmail server, it can get response,



But telnet the 25 port, it can nothing,

telnet 25


Interesting, the email port 25 is blocked, we double check the firewall in the server, can make sure it's not the issues on the server, and must be the Aliyun Block the email port.


5. Submit Ticket to Aliyun

We have to submit ticket to Aliyun to ask them open the 25 port.  But get an abused response:


Simply, they said based on some laws in China, to prevent the spam emails, they blocked the 25 port.

I never see a VPS/Server blocked port by the ISP before, this is the first time. waste the time of our team and our clients.


6. Best solution: Web API to send email on Aliyun Server

take gmail for example: it provider the WEB API to replace SMTP port: 

sendgrid and mailgun is also recommend. 

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.