14 Nov

Send Emails the Secure Way: A Guide to SMTP Authentication

In today’s web hosting environment, email functionality is essential for communication, whether for notifications, user verification, or marketing. However, to maintain security and reliability, we have disabled the native php mail() function on our hosting servers. This decision was made to enhance security, reduce spam, and ensure better deliverability of emails.

Why Is the PHP Mail Function Disabled?

  1. Security Concerns: The php mail() function is often exploited by malicious users or scripts to send spam or phishing emails. These activities can damage the reputation of our hosting servers and lead to blacklisting by major email providers.
  2. Lack of Authentication: The php mail() function does not inherently support authentication, making it easier for emails to be spoofed. This can compromise trust in your emails and affect user engagement.
  3. Poor Deliverability: Emails sent using the php mail() function are more likely to end up in spam folders or be outright rejected by receiving servers due to lack of proper authentication headers.

To address these issues, we recommend using SMTP (Simple Mail Transfer Protocol) for sending emails from scripts. SMTP supports authentication and allows you to send emails through a secure, authenticated channel, ensuring that your emails are delivered reliably.

Benefits of Using SMTP Authentication

  • Enhanced Security: SMTP requires authentication before sending emails, reducing the risk of unauthorized use and spam.
  • Better Deliverability: Emails sent using authenticated SMTP are more trusted by receiving servers, improving their chances of landing in the inbox.
  • Traceability: SMTP provides better logging and tracking options, making it easier to troubleshoot email delivery issues.

Example of an Email Script Using SMTP Authentication

Here’s a simple PHP script that uses the PHPMailer library to send an email via SMTP:

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'path/t1o/PHPMailer/src/Exception.php';
require 'path/to/PHPMailer/src/PHPMailer.php';
require 'path/to/PHPMailer/src/SMTP.php';

// Create a new PHPMailer instance
$mail = new PHPMailer(true);

try {
    // Server settings
    $mail->isSMTP();
    $mail->Host = 'locallhost'; // Set your SMTP server
    $mail->SMTPAuth = true;
    $mail->Username = 'your-email@domain.com'; // SMTP username
    $mail->Password = 'your-password'; // SMTP password
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption
    $mail->Port = 587; // TCP port to connect to

    // Recipients
    $mail->setFrom('from@domain.com', 'Mailer');
    $mail->addAddress('recipient@domain', 'Recipient Name');

    // Content
    $mail->isHTML(true);
    $mail->Subject = 'Test Email';
    $mail->Body    = 'This is a test email sent using SMTP authentication.';

    // Send the email
    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>

Users can download the PHPMailer library from the following sources:

  1. Composer (Recommended):
    • Run the following command in the terminal to install PHPMailer using Composer:
      composer require phpmailer/phpmailer
  2. GitHub:
    • Visit the PHPMailer GitHub repository to download the latest release as a ZIP file.
    • Extract the files and include them in your project.
  3. Official PHPMailer Website:

Steps to Implement SMTP in Your Script

  1. Configure SMTP settings: Update the SMTP host, username, password, and port as per your server’s configuration.
  2. Secure Your Credentials: Always store your SMTP credentials securely, using environment variables or secure storage practices.

By using SMTP authentication, you help maintain the security and deliverability of your emails. This practice ensures that your emails reach your recipients without issue and preserves the reputation of our hosting servers.

16 Aug

Starting a Web Hosting Company – Obstacles

As with any company, you’re going to run into obstacles. You will face new challenges almost every day, and how you deal with those challenges will determine if you come out stronger, or so damaged you end up closing up shop..

The key here is proper planning. From the very basics all the way to the most complex, you need to have a plan of action written down that you’re going to follow. As you face each challenge, you would then be able to consult your strategy and deal with it logically.

For example, some challenges you will face:
– Drop in sales
– Increase in cancellations
– Shortage of funds
– Downtime
– Mistakes in service
– Angry customers
– Negative Reviews
– Increased Competition

Just to name a few. You can combat all of the above easily.. Let’s take negative reviews for example. So long as you are providing a good service, are confident you have done everything in your power to ensure satisfaction, have been professional and offered resolutions to the customer, then you have nothing to worry about. In your plan of action, make sure you have a strategy for handling bad reviews, don’t just go in all guns blazing.

A part of my process to maintain quality is making sure my attention is where it is needed most. I can’t possibly monitor all tickets, and not all tickets require monitoring, however it is important you don’t miss important tickets out.. A good filter I put in place, is monitoring tickets that have too many back & forth replies. If something isn’t resolved within the first few replies, then typically, something is wrong. I will monitor those tickets and see why it is taking so long to resolve. I will go back and consult whoever worked on the ticket and ask why this is taking so long. I typically intervene at that point, implement a structured approach to resolution.

Let’s take another example.. Increased competition. Competition is just a way of business. I know a few hosts, in particular one small mainly UK web host that seems obsessed with what we do. Going as far as copying our plan names word for word, our site structure, type of wording, services we offer and even under cutting the prices. Should we be worried? Nope, not at all. A company that copies is always one step behind. Always a minute too late in getting the sale. Lack innovation and shows their inability to come up with their own ideas. Only sees what’s on the outside, but isn’t aware of the internal processes which ensure we deliver what we promise. We need a little bit of a pinch to keep the heat on, increase our efforts and eliminate the competition. We have a plan of action which keeps such companies at bay. It is a good idea for you to have one too, as ultimately, you will one day face such a scenario too and it will be important for you to stay ahead of the game.. Web Hosting isn’t an easy industry, it’s not just about getting a reseller account and a website.. You need to make sure you can get the sale, you need to make sure you give your customers a better reason other than price to sign up with you.

Having a plan of action will ensure you are prepared and equipped to handle the many challenges you are going to face.