WordPress can send e‑mail messages for notifications, password resets, and contact forms. By default, it uses the PHP mail() function, but this often leads to delivery issues. On ruachost.com, the recommended approach is to configure WordPress to send e‑mail using SMTP authentication.

 

Why Use SMTP Instead of PHP mail()?

  • Ensures reliable delivery of e‑mails.

  • Reduces the chance of messages being marked as spam.

  • Provides encryption for secure communication.

  • Allows you to authenticate with your hosting account’s mail server.

 

Method 1: Using a Plugin (Recommended)

The easiest way to configure e‑mail is with the WP Mail SMTP plugin.

Steps:

  1. Log in to WordPress as an administrator.

  2. Go to Plugins → Add New.

  3. Search for WP Mail SMTP by WPForms.

  4. Click Install Now, then Activate.

  5. In the dashboard, go to WP Mail SMTP → Settings.

  6. Enter the following details:

    • From Email → Your ruachost.com e‑mail address.

    • From Name → The name you want associated with the e‑mail.

    • Return Path → Check “Set the return‑path to match the From Email.”

    • Mailer → Select Other SMTP.

    • SMTP Host → Your account’s mail server name (e.g., mail.ruachost.com).

    • SMTP Port465 for SSL or 25 for no encryption.

    • Encryption → Choose SSL if possible.

    • Authentication → On.

    • SMTP Username → Your full e‑mail address.

    • SMTP Password → Your e‑mail account password.

  7. Save settings.

  8. Send a test e‑mail from the plugin to confirm configuration.

✅ Your WordPress site will now send e‑mails reliably through SMTP.

 

Method 2: Using WordPress API (Advanced)

If you prefer not to use a plugin, you can configure SMTP manually in wp-config.php and a custom plugin:

 
define( 'SMTP_HOST', 'mail.ruachost.com' );
define( 'SMTP_AUTH', true );
define( 'SMTP_PORT', '465' );
define( 'SMTP_SECURE', 'ssl' );
define( 'SMTP_USERNAME', 'user@yourdomain.com' );
define( 'SMTP_PASSWORD', 'yourpassword' );
define( 'SMTP_FROM', 'user@yourdomain.com' );
define( 'SMTP_FROMNAME', 'Your Name' );


Then, in your plugin code:

add_action('phpmailer_init', function($phpmailer) {
    $phpmailer->isSMTP();
    $phpmailer->Host       = SMTP_HOST;
    $phpmailer->SMTPAuth   = SMTP_AUTH;
    $phpmailer->Port       = SMTP_PORT;
    $phpmailer->SMTPSecure = SMTP_SECURE;
    $phpmailer->Username   = SMTP_USERNAME;
    $phpmailer->Password   = SMTP_PASSWORD;
    $phpmailer->From       = SMTP_FROM;
    $phpmailer->FromName   = SMTP_FROMNAME;
});
 

Use the wp_mail() function to send e‑mails:

wp_mail("recipient@example.com", "Subject", "Message");
 

Important Notes

  • Always use encryption (SSL/TLS) when possible.

  • Ensure your “From Email” address exists on your hosting account.

  • Test configuration after setup to confirm delivery.

  • If e‑mails fail, double‑check SMTP host, port, and credentials.

Дали Ви помогна овој одговор? 0 Корисниците го најдоа ова како корисно (0 Гласови)

Powered by WHMCompleteSolution