PHP Script to Send Email with SMTP Authentification

SMTP authentication serves to prevent a lot of email spam, if the website is compromised by unwanted scripts. The mail() function on shared hosting services is currently disabled for security reasons. Therefore, if sending email through the website using the mail() function, the email cannot be sent. Thus the solution, you can add an SMTP Authentication script so that email delivery through the website can still run.  


SMTP Authentication script to be added, you can follow the following guide:

  1. Login to your Cpanel first
  2. Then please login to WordPress Manager By Softaculous
  3. Then please login to Wordpress Management

  4. Then you can click the Settings > SMTP Mailer menu

  5. Then please follow the picture below:
    - SMTP Authentication = You can change it from False to True
    Then fill in the SMTP username, Password and From email address according to the User and Password
    that you have previously created in cPanel.
    - And if so, you can click the Save Changes button.
  6. Lalu anda bisa lanjut ke menu Test Email



    - Enter the destination Email in the To field
    - Fill in Subject and Message as you wish
    - and then please click the Send Email button
  7. Dan inilah hasilnya :

Good Luck.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.