How To Send Emails Using PHP Script In cPanel?

You can easily send emails using a PHP script in cPanel. We have already written an article about How to send HTML Mails in PHP from cPanel. Both the methods are similar apart from their codes. In this tutorial, we’re gonna use a PHP script and the codes inside it will be written in PHP itself. Whereas in our previous article, we had done the same process with a hybrid code.Send Emails Using PHP Script In cPanel

This article is quite useful for those who want to simplify the email sending process without opening the Webmail. Yes, you can send emails directly from your cPanel without opening webmail. Let’s dive right in!!

Related Article =〉 Setup Webmails Email Accounts on iPhone
  • Log into your cPanel account.
  • Move inside your Root Directory & click over the +File button to create a new file.Create a new file - redserverhost 1


  • Give your file a name & hit the Create New File button.Create a new file with any name


  • Now right-click over the newly created file and click over the Edit button.Edit the newly created file of cpanel


  • Now copy the below code & paste it inside the newly created file.

  • Change the dummy emails & other details, hit the Save Changes button at last.Change PHP code


  • Now hit that file from outside and see what happens.The Email Message Was Sent - Redserverhost


  • As you can see above, the email message was sent successfully. Now let’s open the Webmail for confirmation. To do so, type or and log in to your webmail.Log in to the Webmail


  • As you can see, I’ve opened the Receipts email, and the email that we sent from the cPanel is present.Email Received Successfully - Redserverhost


  • Open that mail to verify the contents inside it.Email Sent Successfully & opened


Hence, you can easily send emails to anyone from cPanel also. No need to open webmail again & again. Just replace the receptionist email & hit the file from outside.

Related Article =〉 How to Configure Outlook for Webmails

With this, you can definitely save some time. If it does, share this article with your friends & colleagues & feel free to hit the comment section for any doubts. Moreover, you can message us on our social media such as; Facebook Twitter for any other inquiries & Web Hosting Details.

Scroll to Top