Website Emails Not Delivered: How to Send Through SMTP
Emails sent by your website — form submissions, order notifications, password resets — sometimes do not arrive or end up in spam. Usually the reason is that the website sends them with the PHP mail() function: these messages are sent without logging in to a mailbox, and Gmail, Outlook and other mail services do not trust them. The reliable way is to send them through the SMTP of a mailbox on the website's domain, the same way a regular mail app does.
Step 1. Create a mailbox on the website's domain
You need a mailbox such as info@your-domain.com or noreply@your-domain.com — on the website's own domain, not on Gmail. How to create a mailbox in your panel: ISPmanager, cPanel, Plesk, BrainyCP, FastPanel.
Do not send website emails through a personal Gmail mailbox or another service. The sender address must be on the website's domain, otherwise mail services reject these messages or put them in spam.
Step 2. SMTP settings
The username is the full mailbox address, the password is the mailbox password, and SMTP authentication is on. The server and port depend on the panel:
| Panel | SMTP server | Port and encryption | |
|---|---|---|---|
| ISPmanager | mail.your-domain.com | 465, SSL (if blocked — 587, STARTTLS) | details |
| cPanel | the server address from the Connect Devices page | 465, SSL/TLS | details |
| Plesk | your-domain.com — the mail domain itself | 465, SSL | details |
| FastPanel | mail.your-domain.com or the server IP address | 465, SSL or 587, STARTTLS | details |
The port and encryption must match: 465 — SSL, 587 — STARTTLS (TLS). If they do not match, the website cannot connect to the server.
Step 3. Set up the website
WordPress. Install the WP Mail SMTP plugin, choose "Other SMTP" and fill in the fields with the settings from step 2. Step-by-step guide with screenshots: sending WordPress email via SMTP. The plugin is set up the same way on any panel.
Other CMS. Find the mail section in the website settings and choose SMTP instead of "PHP mail":
- OpenCart — System → Settings → your store → Mail tab: SMTP protocol, server, port, username and password. For port 465 the server is usually entered as
ssl://mail.your-domain.com. - Joomla — System → Global Configuration → Server tab, Mail section: Mailer SMTP, SMTP Security SSL/TLS.
- PrestaShop — Advanced Parameters → E-mail: "Set my own SMTP parameters".
- Laravel and other frameworks — mail settings in the
.envfile:
MAIL_MAILER=smtp
MAIL_HOST=mail.your-domain.com
MAIL_PORT=465
MAIL_ENCRYPTION=ssl
MAIL_USERNAME=info@your-domain.com
MAIL_PASSWORD=mailbox_password
MAIL_FROM_ADDRESS=info@your-domain.comStep 4. Test it
Send a test email from the website to your own address on Gmail or another service — for example, through a form or the plugin's test button. The message should arrive in the Inbox. If it lands in spam, add SPF and DKIM records for the domain: ISPmanager, cPanel, BrainyCP, VestaCP.
Common errors
- Authentication failed — the username has no domain (
infoinstead ofinfo@your-domain.com) or the mailbox password is wrong. You change the password in the panel, in the mailbox settings. - Cannot connect, timeout — the port and encryption do not match (465 — SSL, 587 — STARTTLS), or the server is wrong.
- Message rejected because of the sender address — the sender address in the website settings differs from the mailbox used for sending. Use the same mailbox as the sender.
- No emails at all, and the domain was bought recently — the domain may not point to the hosting yet: how to point a domain to hosting.