Send emails through your PHP contact form
How to make your contact forms successfully send emails
If you're having problems getting your PHP contact form to send emails on your web hosting, then this page should help you solve it.
We explain which settings you need to use to make your contact form work properly on the biggest and most popular web hosting companies.
Form emailing options with PHP
With PHP you have several options when sending emails, the three most common options are listed below:
PHP mail() function
The PHP mail() function can work and is the simplest option, however, it's very limited and not recommended these days as more and more hosting providers and email systems are blocking these.
Email API's with PHP
Working with email service providers API's is also a more common way to send email using PHP. Although these have real benefits (such as making use of advanced service features that may not be available in SMTP), they also have some downsides, mainly that they are all different so if you decide to switch providers then you most likely need to rebuild your PHP email integration. For PHP contact forms, this is not the recommended way unless there's a very good reason.
PHP SMTP Connection
Sending emails through PHP with SMTP is usually the best option for several reasons. You can use a local or remote SMTP Server, and you can make use of powerful libraries that know how to speak to a huge list of SMTP Servers.
SMTP is the recommended option and covered on this page.
Sending PHP emails with SMTP
Pick your hosting provider below to see which settings to use.
If your hosting provider is not yet listed, then we suggest asking your hosting provider this question:
What's the outgoing SMTP details (hostname, port number, username, and password) needed to send emails through PHP?
If you're trying to run your form on your computer on "localhost", then you need to make sure you've correctly set up your mail server. Details on that are out of the scope of this page.
Still not working for you? don't worry, read the installation guide and contact form troubleshooting for details on how to switch on debug mode and identify your issue.
SMTP Settings for GoDaddy
These are the important SMTP settings you need to use when sending emails with PHP through GoDaddy.
GoDaddy supports standard SMTP connections without SSL or TLS.
SETTING | VALUE |
---|---|
SMTP Host | localhost (Linux) or relay-hosting.secureserver.net (Windows or Classic) |
SMTP Username | (leave empty) |
SMTP Password | (leave empty) |
SMTP Port | 25 |
Email From | An email address using the domain on your GoDaddy account |
These settings are using port 25 which is non-SSL/TLS, however, It may still be possible to send emails with PHP through GoDaddy with TLS on port 587, but you will need to contact support to confirm the correct hostname to use for your account.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using GoDaddy, please let us know.
SMTP Settings for Ionos (1 & 1)
These are the important SMTP settings you need to use when sending emails with PHP through Ionos.
SETTING | VALUE |
---|---|
SMTP Host | smtp.ionos.co.uk |
SMTP Username | Your email address on your Ionos account |
SMTP Password | The password for your email address on your Ionos account |
SMTP Port | 587 |
Email From | An email address using the domain on your Ionos account |
You need to provide the SMTP username or SMTP password for authentication over TLS on port 587 with Ionos.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using Ionos, please let us know.
SMTP Settings for Bluehost
These are the important SMTP settings you need to use when sending emails with PHP through Bluehost.
SETTING | VALUE |
---|---|
SMTP Host | box000.bluehost.com (See note below) |
SMTP Username | Your email address on your Bluehost account |
SMTP Password | The password for your email address on your Bluehost account |
SMTP Port | 465 |
Email From | An email address using the domain on your Bluehost account |
You need to provide the SMTP username or SMTP password for authentication over SSL on port 465 with Bluehost.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using Bluehost, please let us know.
SMTP Settings for OVH Hosting
These are the important SMTP settings you need to use when sending emails with PHP through OVH.
SETTING | VALUE |
---|---|
SMTP Host | ssl0.ovh.net |
SMTP Username | Your email address on your OVH account |
SMTP Password | The password for your email address on your OVH account |
SMTP Port | 465 |
Email From | An email address using the domain on your OVH account |
You need to provide the SMTP username or SMTP password for authentication over SSL on port 465 with OVH.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using OVH, please let us know.
SMTP Settings for Hetzner
These are the important SMTP settings you need to use when sending emails with PHP through Hetzner.
SETTING | VALUE |
---|---|
SMTP Host | mail.mydomain.com |
SMTP Username | Your email address on your Hetzner account |
SMTP Password | The password for your email address on your Hetzner account |
SMTP Port | 587 |
Email From | An email address using the domain on your Hetzner account |
You need to provide the SMTP username or SMTP password for authentication over TLS on port 587 with Hetzner.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using Hetzner, please let us know.
SMTP Settings for Namecheap
These are the important SMTP settings you need to use when sending emails with PHP through Namecheap.
SETTING | VALUE |
---|---|
SMTP Host | The domain name of your Namecheap account |
SMTP Username | Your email address on your Namecheap account |
SMTP Password | The password for your email address on your Namecheap account |
SMTP Port | 587 |
Email From | An email address using the domain on your Namecheap account |
You need to provide the SMTP username or SMTP password for authentication over TLS on port 587 with Namecheap.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using Namecheap, please let us know.
SMTP Settings for Liquid Web
These are the important SMTP settings you need to use when sending emails with PHP through Liquid Web.
SETTING | VALUE |
---|---|
SMTP Host | The hostname of your Liquid Web account |
SMTP Username | Your email address on your Liquid Web account |
SMTP Password | The password for your email address on your Liquid Web account |
SMTP Port | 587 |
Email From | An email address using the domain on your Liquid Web account |
You need to provide the SMTP username or SMTP password for authentication over TLS on port 587 with Liquid Web.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using Liquid Web, please let us know.
SMTP Settings for Siteground
These are the important SMTP settings you need to use when sending emails with PHP through Siteground.
SETTING | VALUE |
---|---|
SMTP Host | The domain name of your Siteground account |
SMTP Username | Your email address on your Siteground account |
SMTP Password | The password for your email address on your Siteground account |
SMTP Port | 587 |
Email From | An email address using the domain on your Siteground account |
You need to provide the SMTP username or SMTP password for authentication over TLS on port 587 with Siteground.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using Siteground, please let us know.
SMTP Settings for DreamHost
These are the important SMTP settings you need to use when sending emails with PHP through DreamHost.
SETTING | VALUE |
---|---|
SMTP Host | smtp.dreamhost.com |
SMTP Username | Your email address on your DreamHost account |
SMTP Password | The password for your email address on your DreamHost account |
SMTP Port | 465 |
Email From | An email address using the domain on your DreamHost account |
You need to provide the SMTP username or SMTP password for authentication over SSL on port 465 with DreamHost.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using DreamHost, please let us know.
SMTP Settings for InMotion
These are the important SMTP settings you need to use when sending emails with PHP through InMotion.
SETTING | VALUE |
---|---|
SMTP Host | secure00.inmotionhosting.com (see note below) |
SMTP Username | Your email address on your InMotion account |
SMTP Password | The password for your email address on your InMotion account |
SMTP Port | 465 |
Email From | An email address using the domain on your InMotion account |
You need to provide the SMTP username or SMTP password for authentication over SSL on port 465 with InMotion Hosting.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using InMotion, please let us know.
SMTP Settings for HostGastor
These are the important SMTP settings you need to use when sending emails with PHP through HostGastor.
SETTING | VALUE |
---|---|
SMTP Host | servername.hostgator.com (see note below) |
SMTP Username | Your email address on your HostGastor account |
SMTP Password | The password for your email address on your HostGastor account |
SMTP Port | 465 |
Email From | An email address using the domain on your HostGastor account |
You need to provide the SMTP username or SMTP password for authentication over SSL on port 465 with HostGastor.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using HostGastor, please let us know.
SMTP Settings for Hostinger
These are the important SMTP settings you need to use when sending emails with PHP through Hostinger.
SETTING | VALUE |
---|---|
SMTP Host | smtp.hostinger.com |
SMTP Username | Your email address on your Hostinger account |
SMTP Password | The password for your email address on your Hostinger account |
SMTP Port | 587 |
Email From | An email address using the domain on your Hostinger account |
You need to provide the SMTP username or SMTP password for authentication over TLS on port 587 with Hostinger.
SMTP Host and Port settings with contact form installer
SMTP "Email From" setting with contact form installer
If this solution didn't work for you and you are using Hostinger, please let us know.