解决Opencart 2.0.2.0 发不出邮件问题

在升级Opencart到2.0.2.0后大家会发现,邮件配置突然间不好用了。

提示以下报错:

Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /system/library/mail.php on line 168
Warning: fsockopen(): unable to connect to :25 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /system/library/mail.php on line 168
Notice: Error: php_network_getaddresses: getaddrinfo failed: Name or service not known (0) in /system/library/mail.php on line 171

不要担心,这不是你手动调试出了问题。所有人都遇到同样的问题。

这已经被Github的同人证实,这是一个bug,你只需要将以下文件中的config_mail_smtp_host改成config_mail_smtp_hostname,就可以使用邮件系统了

upload/admin/controller/common/forgotten.php
upload/admin/controller/marketing/contact.php
upload/admin/model/marketing/affiliate.php
upload/admin/model/sale/customer.php
upload/admin/model/sale/return.php
upload/admin/model/sale/voucher.php
upload/catalog/controller/account/forgotten.php
upload/catalog/controller/affiliate/forgotten.php
upload/catalog/controller/information/contact.php
upload/catalog/model/account/customer.php
upload/catalog/model/affiliate/affiliate.php
upload/catalog/model/catalog/review.php
upload/catalog/model/checkout/order.php
upload/catalog/model/checkout/voucher.php
upload/catalog/model/openbay/ebay_order.php
upload/system/library/ebay.php
upload/system/library/openbay.php