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.


GoDaddy SMTP

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.

The SMTP host differs depending on your hosting type. ON Linux servers it's localhost and on Windows servers it's relay-hosting.secureserver.net.

SMTP Host and Port settings with contact form installer

SMTP host and port settings with Localhost

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using GoDaddy, please let us know.


Ionos SMTP

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 host and port settings with Ionos

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using Ionos, please let us know.


Bluehost SMTP

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.

NOTE: The SMTP host above is listed as box000.bluehost.com as an example, your host may have a different number after the "box" part. To find out, go to your cPanel and look under the Email Configuration settings for this.

SMTP Host and Port settings with contact form installer

SMTP host and port settings with Bluehost

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using Bluehost, please let us know.


OVH SMTP

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 host and port settings with OVH

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using OVH, please let us know.


Hetzner SMTP

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.

NOTE: You would replace the "mydomain.com" parts with your own domain name.

SMTP Host and Port settings with contact form installer

SMTP host and port settings with Hetzner

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using Hetzner, please let us know.


Namecheap SMTP

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 host and port settings with TLS

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using Namecheap, please let us know.


Liquid Web SMTP

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.

The SMTP host should be your servers hostname. If you're not sure what this is, contact Liquid Web support to find out.

SMTP Host and Port settings with contact form installer

SMTP host and port settings with TLS

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using Liquid Web, please let us know.


Siteground SMTP

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 host and port settings with TLS

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using Siteground, please let us know.


DreamHost SMTP

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 host and port settings for DreamHost with SSL

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using DreamHost, please let us know.


DreamHost SMTP

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.

NOTE: The SMTP host above is listed as secure00.inmotionhosting.com as an example, your host will have a different number after the "secure" part, this is your Server number. To find out, log in to your InMotion AMP and click on "Account Technical Details" then look for your Server number.

SMTP Host and Port settings with contact form installer

SMTP host and port settings for InMotion with SSL

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using InMotion, please let us know.


HostGator SMTP

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.

NOTE: The SMTP host above is listed as servername.hostgator.com as an example, your host will have a different server name before the ".hostgator.com" part. To find out your server name, log in to cpanel and look under the "General Information" for your "Primary Domain".

SMTP Host and Port settings with contact form installer

SMTP host and port settings for HostGastor with SSL

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using HostGastor, please let us know.


Hostinger SMTP

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.

You can check your SMTP host by loggin into your Hostinger dashboard and going picking "Email Accounts" under the "Email" section then look for the "Outgoing Mail (SMTP) Server" hostname.

SMTP Host and Port settings with contact form installer

SMTP host and port settings for Hostinger with SSL

SMTP "Email From" setting with contact form installer

SMTP email from settings

If this solution didn't work for you and you are using Hostinger, please let us know.