How to change mail server in wordpress

Changing the mail server in WordPress involves updating the settings in your WordPress configuration file and possibly updating your DNS records. Here's a step-by-step guide to help you do so:

Method 1: Update WordPress Configuration File

  1. Access your WordPress site's files: You can do this using an FTP client like FileZilla or a file manager like cPanel's File Manager.

  2. Locate the wp-config.php file: This file is usually located in the root directory of your WordPress installation.

  3. Open the wp-config.php file: Use a text editor like Notepad or Sublime Text to open the file.

  4. Find the define('WP_MAILER', 'smtp'); line: This line is usually located near the top of the file.

  5. Update the mail server settings: Replace the existing mail server settings with your new mail server settings. For example:

    define('WP_MAILER', 'smtp');
    define('SMTP_HOST', 'your_smtp_host');
    define('SMTP_PORT', 'your_smtp_port');
    define('SMTP_USERNAME', 'your_smtp_username');
    define('SMTP_PASSWORD', 'your_smtp_password');

    Replace your_smtp_host, your_smtp_port, your_smtp_username, and your_smtp_password with your new mail server settings.

  6. Save the changes: Save the wp-config.php file.

Method 2: Update WordPress Settings

  1. Log in to your WordPress dashboard: Go to your WordPress site's dashboard and log in with your administrator credentials.
  2. Go to Settings > General: Click on the "Settings" menu and then select "General".
  3. Update the Mail Server Settings: Scroll down to the "Mail Server" section and update the following settings:
    • Mail Server: Select "SMTP" from the dropdown menu.
    • SMTP Host: Enter your new mail server host.
    • SMTP Port: Enter your new mail server port.
    • SMTP Username: Enter your new mail server username.
    • SMTP Password: Enter your new mail server password.
  4. Save the changes: Click the "Save Changes" button to save the updated settings.

Method 3: Update DNS Records (Optional)

If you're using a custom domain and want to use a custom mail server, you may need to update your DNS records. This step is optional, but recommended if you want to use a custom mail server.

  1. Update your DNS records: Contact your DNS provider (e.g., GoDaddy, Namecheap) and update the following records:
    • MX Record: Update the MX record to point to your new mail server.
    • TXT Record: Update the TXT record to verify your mail server.

Verify the Changes

After updating the mail server settings, test your WordPress site's email functionality to ensure that it's working correctly. You can do this by sending a test email from your WordPress site or by checking your email logs.

Remember to update your mail server settings carefully, as incorrect settings can cause issues with your WordPress site's email functionality.