SMTP settings for your contact form
Settings checked against each provider's own documentation in November 2026.
If your PHP contact form says a message was sent but nothing arrives, the email settings are almost always the cause. This page lists the settings to use for the most popular web hosts and email services.
The settings go in fcf-config/fcf.settings.php. The examples below use the same setting names as the free forms, but the server names and ports work with any PHP form that sends through SMTP.
Pick your host or email service
Web hosts: GoDaddy IONOS Bluehost OVHcloud Hetzner Namecheap Liquid Web SiteGround DreamHost InMotion HostGator Hostinger
Email services: Gmail / Google Workspace Microsoft 365 / Outlook SendGrid Mailjet Brevo
Host not listed? Read the basics below, or ask your host: "What outgoing SMTP server, port and encryption should a PHP script use to send email from my account?"
The basics, in two minutes
Use an email account on your own domain
Create a mailbox just for the form in your hosting control panel, for example [email protected], and let the form log in to it.
Send from that address, not from the visitor's: Gmail, Outlook and others reject mail that claims to come from an address the sending server isn't allowed to use.
The free forms set the visitor's address as the reply-to, so pressing Reply still goes to them.
Port and encryption go together
Almost every provider supports one or both of these:
- Port 465 with SSL/TLS:
SMTP_PORT'465'andSMTP_SECURE'SMTPS'. The free forms use this by default. - Port 587 with STARTTLS:
SMTP_PORT'587'andSMTP_SECURE'STARTTLS'.
Mixing them up (465 with STARTTLS, or 587 with SMTPS) is one of the most common mistakes, and usually ends in a timeout. If one pair doesn't work, try the other.
On cPanel hosting, use the server's name
Many cPanel hosts suggest mail.yourdomain.com. That only works if your domain points at your hosting. If it points somewhere else, for example through Cloudflare, the form can't connect.
The safe choice is the server name: in cPanel it's on the main page as Server Name, or under Email Accounts → Connect Devices in the Secure SSL/TLS Settings box.
It also avoids certificate errors, because the server's certificate is issued for that name.
Check your domain's SPF and DKIM
These DNS records tell other mail servers your messages are genuine. Without them, form emails often go to spam. In cPanel, open Email Deliverability and fix anything it flags. See emails going to spam for the full steps, including DMARC.
Still stuck?
Use the form's built-in self-test page, or turn on SMTP debugging to see exactly what the mail server says. See also why form emails don't arrive and the installation guide.
Web hosts
GoDaddy
GoDaddy's shared hosting doesn't let scripts log in to a mailbox. Instead, it provides a relay on the hosting server itself, with no username, password or encryption.
define('USE_SMTP', 'YES');
define('SMTP_HOST', 'localhost'); // Windows hosting: relay-hosting.secureserver.net
define('SMTP_PORT', '25');
define('SMTP_SECURE', '');
define('SMTP_AUTH', 'NO');
define('EMAIL_FROM', '[email protected]');
EMAIL_FROMmust be an address on a domain whose DNS you manage. Never a Gmail or Yahoo address.- Add GoDaddy's servers to your SPF record:
v=spf1 include:secureserver.net -all(merge it into your existing record if you have one). - GoDaddy also supports PHP's built-in mail function. If the relay doesn't work, set
USE_SMTPto'NO'. - Using GoDaddy's Microsoft 365 email? See Microsoft 365.
IONOS (1&1)
define('SMTP_HOST', 'smtp.ionos.co.uk'); // see below for your country
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS'); // or port 587 with STARTTLS
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- The server depends on where you signed up:
smtp.ionos.co.uk(UK),smtp.ionos.com(US),smtp.ionos.de(Germany) and so on. It's shown in your IONOS email settings. - IONOS rejects mail whose sender address isn't on the same domain as the mailbox, so leave
EMAIL_FROMempty to send from the mailbox itself.
Bluehost
define('SMTP_HOST', 'mail.yourdomain.com'); // or the server name from cPanel
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS');
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- Bluehost's documentation gives
mail.yourdomain.com. If your domain points elsewhere (for example through Cloudflare), use the server name shown in cPanel instead. Older guides mentionbox###.bluehost.comnames, which no longer apply to most accounts. - Using Bluehost Professional Email instead of cPanel email? The server is
smtp.titan.email, port 465 with SSL.
OVHcloud
define('SMTP_HOST', 'smtp.mail.ovh.net'); // Americas/Asia-Pacific: smtp.mail.ovh.ca
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS'); // or port 587 with STARTTLS
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- These are for the MX Plan email included with OVHcloud web hosting. The older server name
ssl0.ovh.netstill works. - Email Pro and Hosted Exchange accounts use their own server names (
pro?.mail.ovh.netorex?.mail.ovh.net) on port 587. Check your control panel.
Hetzner
define('SMTP_HOST', 'mail.your-server.de'); // exactly as written
define('SMTP_PORT', '587');
define('SMTP_SECURE', 'STARTTLS');
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- Enter
mail.your-server.deliterally. Don't replace any part of it with your own domain. - Hetzner says scripts on its web hosting must use port 587. The free forms default to 465, so change both the port and
SMTP_SECURE.
Namecheap
Namecheap sells two kinds of email, with different settings.
Email included with shared hosting (cPanel):
define('SMTP_HOST', 'server123.web-hosting.com'); // your server name from cPanel
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS'); // or port 587 with STARTTLS
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
Namecheap Private Email:
define('SMTP_HOST', 'mail.privateemail.com');
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS'); // or port 587 with STARTTLS
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
Liquid Web
define('SMTP_HOST', 'host.yourdomain.com'); // your server's hostname
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS'); // or port 587 with STARTTLS
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- For secure connections, Liquid Web says to use the server's hostname, not your domain name. It's listed in cPanel under Email Accounts → Connect Devices.
SiteGround
define('SMTP_HOST', 'mail.yourdomain.com'); // or the exact name from Site Tools
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS');
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- SiteGround uses its own Site Tools instead of cPanel. For the exact server name, go to Site Tools → Email → Accounts, open the menu next to the mailbox, choose Mail Configuration, then Manual Settings.
- If you get certificate errors with
mail.yourdomain.com, use the name shown there instead.
DreamHost
define('SMTP_HOST', 'smtp.dreamhost.com');
define('SMTP_PORT', '587');
define('SMTP_SECURE', 'STARTTLS');
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- DreamHost recommends port 587 with STARTTLS. The free forms default to 465, so change both the port and
SMTP_SECURE.
InMotion Hosting
define('SMTP_HOST', 'secure123.inmotionhosting.com'); // your server number
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS'); // or port 587 with STARTTLS
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- Replace the number with your own server number, shown in AMP → Account Technical Details. InMotion's Email Configuration Tool also lists your exact settings.
mail.yourdomain.comalso works if your domain points at InMotion, but can cause certificate errors.
HostGator
define('SMTP_HOST', 'gator1234.hostgator.com'); // your server name
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS');
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- Your server name (
gator####.hostgator.comor similar) is in your welcome email, and in cPanel under General Information. - Port 465 with SSL is HostGator's encrypted option for sending.
Hostinger
define('SMTP_HOST', 'smtp.hostinger.com');
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS'); // or port 587 with STARTTLS
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your mailbox password');
- To check, go to hPanel → Emails, choose your domain, then Configuration settings → Manual Configuration.
Email services
If your website's email isn't reliable, you can send through a separate email service instead. You'll need to verify your sender address or domain with the service first,
and set EMAIL_FROM to that verified address, because the login for these services isn't an email address.
Gmail and Google Workspace
define('SMTP_HOST', 'smtp.gmail.com');
define('SMTP_PORT', '465');
define('SMTP_SECURE', 'SMTPS'); // or port 587 with STARTTLS
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your 16-character app password');
- Your normal Google password won't work. Turn on 2-Step Verification, then create an app password in your Google Account under Security. Paste it without the spaces.
- Gmail limits how much you can send per day, and mail "from" a Gmail address sent via your website is more likely to be treated as suspicious. It's fine for testing or a small site, but an address on your own domain is better.
Microsoft 365 and Outlook
define('SMTP_HOST', 'smtp.office365.com');
define('SMTP_PORT', '587');
define('SMTP_SECURE', 'STARTTLS');
define('SMTP_USER', '[email protected]');
define('SMTP_PASS', 'your password');
SendGrid
define('SMTP_HOST', 'smtp.sendgrid.net');
define('SMTP_PORT', '587');
define('SMTP_SECURE', 'STARTTLS');
define('SMTP_USER', 'apikey'); // literally the word apikey
define('SMTP_PASS', 'your SendGrid API key');
define('EMAIL_FROM', '[email protected]'); // a verified sender
- The username is the word
apikey, exactly as written, not your account email.
Mailjet
define('SMTP_HOST', 'in-v3.mailjet.com');
define('SMTP_PORT', '587');
define('SMTP_SECURE', 'STARTTLS');
define('SMTP_USER', 'your Mailjet API key');
define('SMTP_PASS', 'your Mailjet secret key');
define('EMAIL_FROM', '[email protected]'); // a verified sender
- Both keys are in your Mailjet account under SMTP and SEND API Settings.
Brevo (formerly Sendinblue)
define('SMTP_HOST', 'smtp-relay.brevo.com');
define('SMTP_PORT', '587');
define('SMTP_SECURE', 'STARTTLS');
define('SMTP_USER', 'your Brevo SMTP login');
define('SMTP_PASS', 'your Brevo SMTP key');
define('EMAIL_FROM', '[email protected]'); // a verified sender
- Copy the login from Settings → SMTP & API → SMTP. Depending on when you signed up, it's either your account email or an address ending in
@smtp-brevo.com. - Create an SMTP key on the same page. A Brevo API key won't work here.
Found a setting that's changed, or want a host added? Let me know.