Live Chat
Domain Scan
(empty)
Login
Setting Up Email Autoresponder in cPanel - with Register.lk
(SMTP Authenticated)
An email autoresponder is a program that automatically responds to incoming emails with a predefined message. It's a useful tool for managing customer inquiries, providing immediate acknowledgments, and ensuring timely responses to routine queries. By setting up an email autoresponder, you can enhance your communication efficiency and ensure that no email goes unanswered, even during off-hours or busy periods.
In this guide, we will walk you through setting up an SMTP authenticated email autoresponder in cPanel using a PHP script with PHPMailer. This will allow you to automatically respond to incoming emails with a predefined message.
Let's begin the configuration step by step.
1. Create Folder and Add Files
First, you need to create a folder named scripts in your cPanel file manager. Once created, add the files from the following repository to the newly created folder:
Download the code from this repository
Make sure the config,PHPMailer, and pipe folders are included in the scripts folder. The file paths will look like:
If you place the files in a different location, ensure you modify the $directoryPath variable in the scripts below to reflect the new file paths correctly.
- /config/smtpconfig.php
- /pipe/autorespond.php
- /pipe/emailpipe.php
2. Replace Required Fields
Next, you'll need to configure the SMTP settings for the sender email. Locate the file /config/.smtpconfig and replace the placeholder fields with your actual SMTP settings. This file will include configurations such as the SMTP host, port, username, and password.
(You can find the necessary SMTP mail settings in cPanel under Email Accounts > Connect Devices.)
Example of SMTP configuration fields:
3. Change File Permission
To ensure that the email piping works correctly, you must change the file permissions for emailpipe.php. Navigate to the file located at /pipe/emailpipe.php and set its permissions to 777. This can typically be done through the cPanel file manager by right-clicking on the file and selecting the "Change Permissions" option.
4. Add Forwarder
The final step is to set up an email forwarder in cPanel. This will forward incoming emails to the autoresponder script. Follow these steps:
- Navigate to cPanel > Forwarders
- Click on Add Forwarder
- Set up the forwarder with the following details:
Address to Forward: Enter the email address from which the emails will be forwarded (e.g., your-email@example.com).
Destination: Choose Advanced Options and select Pipe to a Program. Enter the path to the emailpipe.php script (e.g., scripts/pipe/emailpipe.php).
Note: When setting up the forwarders, exclude the /home/USERNAME part from the path, as cPanel will automatically prepend it. Once these steps are completed, your autoresponder should be set up and ready to respond to incoming emails.
Additional Information
The autoresponder uses an HTML template to format the response email. This template is located at '/pipe/emailbody.html'. A test HTML template is included in the repository, which you can replace with your own HTML code. Ensure that the file name remains 'emailbody.html'. If you change the file name, you must also update the file path in '/pipe/autorespond.php' to reflect the new name.
Reference
For further customization and understanding of the PHPMailer library used in this setup, you can refer to the official PHPMailer GitHub repository:
PHPMailer on GitHub
Conclusion
By following these steps, you can efficiently set up an SMTP authenticated email autoresponder in cPanel. This setup is particularly useful for automated responses, customer support acknowledgments, and other automated email handling tasks. Make sure to test your configuration thoroughly to ensure that it is working as expected.
1. Create Folder and Add Files
First, you need to create a folder named scripts in your cPanel file manager. Once created, add the files from the following repository to the newly created folder:
Download the code from this repository
Make sure the config,PHPMailer, and pipe folders are included in the scripts folder. The file paths will look like:
- /home/USERNAME/scripts/config
- /home/USERNAME/scripts/PHPMailer
- /home/USERNAME/scripts/pipe
- /home/USERNAME/scripts/PHPMailer
- /home/USERNAME/scripts/pipe
If you place the files in a different location, ensure you modify the $directoryPath variable in the scripts below to reflect the new file paths correctly.
- /config/smtpconfig.php
- /pipe/autorespond.php
- /pipe/emailpipe.php
2. Replace Required Fields
Next, you'll need to configure the SMTP settings for the sender email. Locate the file /config/.smtpconfig and replace the placeholder fields with your actual SMTP settings. This file will include configurations such as the SMTP host, port, username, and password.
(You can find the necessary SMTP mail settings in cPanel under Email Accounts > Connect Devices.)
Example of SMTP configuration fields:
SMTP Host: smtp.example.com
SMTP Port: 587
SMTP Username: your-email@example.com
SMTP Password: your-email-password
SMTP Port: 587
SMTP Username: your-email@example.com
SMTP Password: your-email-password
3. Change File Permission
To ensure that the email piping works correctly, you must change the file permissions for emailpipe.php. Navigate to the file located at /pipe/emailpipe.php and set its permissions to 777. This can typically be done through the cPanel file manager by right-clicking on the file and selecting the "Change Permissions" option.
4. Add Forwarder
The final step is to set up an email forwarder in cPanel. This will forward incoming emails to the autoresponder script. Follow these steps:
- Navigate to cPanel > Forwarders
- Click on Add Forwarder
- Set up the forwarder with the following details:
Address to Forward: Enter the email address from which the emails will be forwarded (e.g., your-email@example.com).
Destination: Choose Advanced Options and select Pipe to a Program. Enter the path to the emailpipe.php script (e.g., scripts/pipe/emailpipe.php).
Note: When setting up the forwarders, exclude the /home/USERNAME part from the path, as cPanel will automatically prepend it. Once these steps are completed, your autoresponder should be set up and ready to respond to incoming emails.
Additional Information
The autoresponder uses an HTML template to format the response email. This template is located at '/pipe/emailbody.html'. A test HTML template is included in the repository, which you can replace with your own HTML code. Ensure that the file name remains 'emailbody.html'. If you change the file name, you must also update the file path in '/pipe/autorespond.php' to reflect the new name.
Reference
For further customization and understanding of the PHPMailer library used in this setup, you can refer to the official PHPMailer GitHub repository:
PHPMailer on GitHub
Conclusion
By following these steps, you can efficiently set up an SMTP authenticated email autoresponder in cPanel. This setup is particularly useful for automated responses, customer support acknowledgments, and other automated email handling tasks. Make sure to test your configuration thoroughly to ensure that it is working as expected.
With this autoresponder in place, you can improve your email management and enhance your communication efficiency.
Written by: Register.lk Systems Hero - Lakshani