By default, WordPress uses PHP’s mail() function to send emails, which often results in messages landing in spam or failing to deliver. Configuring SMTP ensures reliable email delivery for notifications, password resets, and contact forms. This guide explains how to set up SMTP for WordPress using cPanel email accounts.


Why SMTP Matters

  • Improved Deliverability: Emails are authenticated and less likely to be flagged as spam.
  • Security: SMTP uses encryption (SSL/TLS) for secure transmission.
  • Compatibility: Works with most email providers and hosting environments.

Step 1: Create an Email Account in cPanel

  1. Log in to cPanel.
  2. Navigate to Email → Email Accounts.
  3. Click Create.
  4. Enter:
    • Email Address: e.g., noreply@yourdomain.com
    • Password: Use a strong password.
  5. Click Create.

Step 2: Gather SMTP Details

  • SMTP Host: mail.yourdomain.com
  • SMTP Port:
    • 465 for SSL
    • 587 for TLS
  • Username: Full email address (e.g., noreply@yourdomain.com)
  • Password: The email account password.

Step 3: Install SMTP Plugin in WordPress

Recommended plugins:

  • WP Mail SMTP (by WPForms)
  • Easy WP SMTP

Setup Steps:

  1. Install and activate the plugin.
  2. Go to Settings → WP Mail SMTP.
  3. Enter:
    • From Email: noreply@yourdomain.com
    • From Name: Your site name.
    • Mailer: Other SMTP.
  4. Configure SMTP settings:
    • Host: mail.yourdomain.com
    • Port: 465 (SSL) or 587 (TLS)
    • Encryption: SSL/TLS
    • Authentication: Yes
    • Username: Full email address
    • Password: Email password.

Step 4: Test Email Delivery

  • Use the plugin’s Email Test feature.
  • Send a test email to verify configuration.

Step 5: Enable SPF, DKIM, and DMARC

  • Go to Email Deliverability in cPanel.
  • Ensure SPF and DKIM are enabled.
  • Add DMARC record in Zone Editor:
     
    _dmarc.yourdomain.com TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com"

Advanced Tips

  • Use OAuth 2.0 for Gmail or other providers instead of plain SMTP credentials.
  • Monitor email logs in Email Trace in cPanel.
  • Set up rate limiting for outgoing emails to avoid blacklisting.

Troubleshooting

  • Emails Not Sending: Check SMTP credentials and port settings.
  • Authentication Failed: Reset email password in cPanel.
  • Still Going to Spam: Verify SPF/DKIM alignment and avoid spammy content.
Дали Ви помогна овој одговор? 26 Корисниците го најдоа ова како корисно (98 Гласови)