How to Send HTML Mails in PHP from cPanel?

send html mails using php

Hi there,

In this article, I’m going to tell you How to Send HTML Mails in PHP from cPanel. Yes, you can easily send emails to your client or friends without opening your Webmail account. It is possible via the PHP script that I’m going to give you in this tutorial. Let’s dive right in!

  • Log in to your cPanel account & go inside your Root Directory.cPanel new file create


  • Create a new File with any name.Create new file in cpanel - redserverhost


  • Now copy the below script and paste it inside your newly created file.

  • Replace the dummy emails & contents with your custom once & hit the Save Changes button.Email PHP Script


  • Now hit that file from outside & you’ll receive a “Message was sent” alert.Message was sent window - redserverhost
  • To verify that the message has been sent or not, log in to your webmail by entering the same email that you’ve entered on that PHP script.
  • An email will appear in your Webmail’s Inbox. Open it.

PHP Email Sent


  • You can see the message has been successfully sent & delivered to you with the same credentials & contents.Email Sent Successfully


That’s it. You’ve successfully sent an HTML mail from PHP Script in cPanel.

Thanks for reading the article!! Do not hesitate to hit the comment section if you have any queries regarding the tutorial. Additionally, you can message us on our social media handles such as; Facebook Twitter.

Scroll to Top