Sign inBlogSupportContact
General

Send WordPress emails through SMTP without a plugin

Contact form emails landing in spam. Password resets never arriving. Route WordPress mail through Gmail, SendGrid, or Mailgun with one command.

5 min read May 2026 enable smtp

Your WordPress emails are silently failing

You built a contact form. A customer fills it out. You never get the email. Six months later, you check your spam folder and find 47 missed inquiries — customers you never responded to, leads you never converted.

This is what happens when WordPress uses PHP's mail() function by default. Most shared hosts either don't have proper SPF/DKIM records, or major providers treat server-generated email as suspicious. Your password reset emails, order confirmations, and contact forms all arrive in the spam folder — if they arrive at all.

The fix is to route WordPress email through a proper SMTP server. Every WordPress admin needs this. Almost nobody has it configured correctly.

What most people do instead

The standard WordPress-SMTP playbook ends in one of three places. None is ideal.

Install WP Mail SMTP or similarYet another plugin to maintain, update, and potentially conflict with others. Premium features gated behind upgrades.
Paste code into functions.phpHook into phpmailer_init and configure manually. Works until you switch themes. Credentials in plaintext.
Configure server-level SMTPRequires SSH access and postfix/sendmail knowledge. Out of reach for most admins on shared hosting.

A better way: one command, persistent config

Open the TrueCommander navigator. Type enable smtp. Fill in host, port, username, password. Hit Enter.

The command stores your SMTP credentials and registers itself as a startup command — so the configuration loads on every request automatically. WordPress now routes all mail through your SMTP server. Re-run the command anytime to update credentials.

TrueCommander
SMTP enabled
Registered as startup command
Host: smtp.gmail.com:587TLS
From: you@yourdomain.com
Active on every requestpersistent

Credentials stored in the database, not plaintext files. Unlike functions.php snippets, passwords never appear in a file that gets committed to version control. The command is registered as a startup entry — disable it, and SMTP reverts to default WordPress mail.

How it works

The command hooks into WordPress's phpmailer_init action with your credentials, then auto-registers itself in the Startup Commands module so the configuration loads on every page request.

1
Run the command with your SMTP credentialsHost, port, username, password, encryption (TLS/SSL/none)
2
Auto-registered as a startup commandConfiguration persists across requests. No theme or plugin dependency.
3
Re-run to update, disable to revertSame command updates existing credentials. Disable via Startup Commands to revert to default mail.
ParameterValue
-hostSMTP server (e.g., smtp.gmail.com, smtp.sendgrid.net)
-port587 for TLS, 465 for SSL, 25 for plaintext (rarely used)
-usernameYour email address or SMTP username
-passwordApp-specific password or SMTP password
-encryptiontls, ssl, or none
-from_emailOverride From: header (optional)
Can be used in

Real example

You're running a WooCommerce store on a shared host. Order confirmation emails are arriving in customer spam folders. Support tickets about "never got the email" pile up.

You open TrueCommander and type enable smtp. Fill in SendGrid credentials (free tier covers 100 emails/day). Run. The command registers itself as a startup command, so from this moment forward every WordPress-generated email — order confirmations, password resets, contact form submissions, WooCommerce notifications — routes through SendGrid with proper SPF/DKIM authentication.

Customers start receiving emails in their inbox. Support tickets drop. You never think about SMTP again.

Goes further with TrueCommander

Once SMTP is working, the Email Template Builder and macros unlock a new layer.

Ready?

Stop losing emails to the spam folder.

This is one of 91 commands. All included with every license.

Cookies. The short version.

Essential cookies keep the cart and theme working. Analytics only fire if you say yes. Read our policy.