Send emails through SMTP authentification

As of 31/03/2015, PHP Mail() function has been disabled on shared Linux servers for security reasons. These measures were taken primarily to avoid problems caused by IP blacklisting for spam. Blacklisting of the IP will lead to the impossibility of sending emails to all clients on the server.

Below are the necessary settings, depending on the platform used, to configure sending emails via SMTP.

1. No platform or CMS installed:

You can send messages through SMTP by inserting the following PHP code:


ini_set("include_path", '/home/username/php:' . ini_get("include_path") ); 
    require_once "Mail.php";
    $from = "domeniul_dvs_adresa_mail";
    $to = email_destinatar";
    $subject = "subiect";
    $body = "mesaj";
    $host = "nume_server";
    $username = "domeniul_dvs_adresa_mail";
    $password = "domeniul_dvs_parola_mail";                        
    $headers = array (
        'MIME-Version' => '1.0\r\n',
        'Content-Type' => 'text/html; charset=UTF-8\r\n',
        'From' => $from,
        'To' => $to,
        'Subject' => $subject);
    $smtp = Mail::factory('smtp',
        array ('host' => $host,
        'auth' => true,
        'username' => $username,
        'password' => $password));
    $mail = $smtp->send($to, $headers, $body);
    if (PEAR::isError($mail)) { echo("
" . $mail->getMessage() . "
"); }
else { echo("
Mesaj trimis cu succes!
"); }


username -> your cPanel username -> your domain
server_hostname -> your server hostname where your website is hosted (ex.,, etc.); you can find the server hostname by logging into your cPanel account, make sure you are using paper_lantern theme, go to Statistics like in the image below. After click on Server Information. Next to Server Name is specified the server name. The finall adress will be

Search in cPanel -> PHP PEAR Packages and install the following modules:


2. WordPress:

You can install on of the following plugins:

3. Joomla:

For Joomla you will need to do the following:

a. Login to administration area
b. Go to Site >> Global configuration
c. In the Server tab use the following settings:

Mailer: choose SMTP.
SMTP Authentication: choose Yes.
SMTP Security: choose None.
SMTP Port: use port 26.
SMTP Username: (your email account)
SMTP Password: (the password from your email account)
SMTP Host: localhost

Usefull links:


Edit the file public_html/typo3conf/localconf.php and change the following:

    $TYPO3_CONF_VARS['MAIL']['transport'] = 'smtp';
    $TYPO3_CONF_VARS['MAIL']['transport_smtp_server'] = 'localhost';
    $TYPO3_CONF_VARS['MAIL']['transport_smtp_username'] = '';
    $TYPO3_CONF_VARS['MAIL']['transport_smtp_password'] = 'parola_email'; 


You can install the following plugin:


For Prestashop you need to do the following: 

a. Login to the administration area. 
b. Go to Advanced Parameters >> E-mail >> Set my own SMTP parameters
c. In the Email tab, on the bottom use the following settings: 

Mail domain name: Domain name (It's not mandatory)
SMTP Server: mail.domain.tld 
SMTP Username: email@domain.tld 
SMTP Password: password
Encryption: None
Port: 25

Usefull links:


For Opencart version below) you need to follow the next steps (the settings remain the same for versions si 

a. Login to the administration area. 
b. Go to Settings >> Store Name >> Actions >> Edit 

c. In the Email tab, on the top use the following settings:

Mail Engine: SMTP
Mail Parameters: mail address
SMTP Hostname: server name (Ex:
SMTP Username: mail address
SMTP Password:mail address password 
SMTP Port: 25 or 465(SSL)


For any further information, please contact us!

  • 14 Users Found This Useful
Was this answer helpful?

Related Articles

Cleaning sites that are infected via FTP

Infection of a website  via FTP, involves the injection of site code into an <iframe>...

Email account configuration in Plesk

In this article we will describe the steps necessary to create a new email account, adding email...

How to configure an email client account

  Bellow you will find the steps that you need to make in order to create a new email account,...

Setup an email account in Thunderbird

  In the following tutorial, you can find the steps that can help you setup an email account in...

Setup an email account in Outlook 2007

In the following tutorial, you can find the steps that can help you setup an email account in...