开发者社区 问答 正文

Cannot send email thought server via PHP Function

Hello,

I face a problem since I migrate my website on Aliyun plaform.

I developed on my personal web-server a website base on Worpress. This 
website need to send email to my customers. I used the PHP function from 
Worpress to send email. Unfortunately since I migrate my website on 
Aliyun I cannot send email anymore. Is there any restriction on Aliyun 
to send email thought your server from PHP function?

Thanks for your answer

Laurent

展开
收起
laurent88 2018-08-21 17:48:23 723 分享 版权
阿里云 AI 助理回答

Hello Laurent,

When you migrate a WordPress website to Alibaba Cloud, it's common to encounter email sending issues due to various reasons, including security restrictions and configurations. Alibaba Cloud does not impose an outright ban on sending emails through its servers using PHP functions like mail(), but there are certain best practices and settings to consider:

  1. Security Group Settings: Ensure that the security group attached to your server (ECS instance) allows outbound traffic on port 25, which is the standard SMTP port. However, note that many cloud providers, including Alibaba Cloud, may restrict or monitor traffic on this port due to spam prevention measures.

  2. SMTP Service: For reliable email delivery, it's recommended to use a professional SMTP service rather than relying on the default PHP mail() function. Alibaba Cloud provides MailService, but for external services, you might consider using SendGrid, Mailgun, or even your own corporate email server via SMTP authentication. You can configure these services in your WordPress site by installing and configuring SMTP plugins such as WP Mail SMTP.

  3. Server IP Reputation: If your server's IP address has been flagged for sending spam in the past, it could be blacklisted, preventing successful email delivery. Check if your IP is listed on any blacklist databases and request delisting if necessary.

  4. DKIM & SPF Records: To improve email deliverability, set up DKIM (DomainKeys Identified Mail) and SPF (Sender Policy Framework) records for your domain. This helps receiving mail servers verify that the email is indeed sent from an authorized source.

  5. Alibaba Cloud Content Security: Make sure your content doesn't trigger Alibaba Cloud's content security systems, which might block emails containing suspicious or spam-like content.

To resolve your issue, follow these steps: - Verify your security group settings. - Implement an SMTP service for more reliable email sending. - Check your IP reputation and domain configuration. - Ensure your email content adheres to best practices.

If you're still facing difficulties after trying these steps, reaching out to Alibaba Cloud support directly would be the next step for further assistance.

有帮助
无帮助
AI 助理回答生成答案可能存在不准确,仅供参考
0 条回答
写回答
取消 提交回答