PHPMail() Function Disabled

There are so many ways to send email using php. The two main ways to do this is either using PHPMail() or SMTP. PHPMail() is open and used by trojans and viruses. Most clients have infected files which just send mails using PHPMail(), because it doesn't authenticate. It doesn't check if the email being sent is actually coming from the domain and this puts a lot of strain on the mail server, making legitimate mails wait in queue for a long time.

SMTP isn't open and the email must be authenticated.... a real email address and password must be written into your code and must be verified by the mail server before the email is sent. This makes the email legitimate.

If you already have a script using PHPMail() function it is very simple to change it to SMTP, you just need to change like 5 lines of your code and add an email address and password (already created in cpanel) into the code, and it will send emails just fine.

We have a sample code which you can use in our download section on our site (http://www.qservers.net/process/downloads.php).

If you are using a cms software like wordpress or joomla please use the smtp plugins available for these softwares.

For Joomla:

At the backend of joomla, under global configuration --> Server --> Mail Settings -->

Mailer: SMTP
SMTP Port: 465
SMTP Authetication: Yes
SMTP Security: SSL
SMTP Username: email address created in cPanel
SMTP Password: password for your email address
SMTP Host: exemple.com


For Wordpress:

1. http://wordpress.org/plugins/easy-wp-smtp/

2. http://wordpress.org/extend/plugins/contact-form-7/


For Developers:

<?php

include('Mail.php'); // modul PHP pear instalat pe server

 

$from = "info@mycompany.com";

$to = "myclient@clients.com";

$subject = "Test message";

$body= "This is a test message.";

 

$headers = array (

    'From' => $from,

    'To' => $to,

    'Subject' => $subject

);

$smtp = Mail::factory(

    'smtp',

    array (

        'host' =>'ssl://mycompany.com',

        'auth' => true,

        'username' => 'info@mycompany.com',

        'password' => 'mypassword',

        'port' => 465

    )

);

$mail = $smtp->send($to, $headers, $body); // sending the email

if (PEAR::isError($mail)){

echo("<p>" . $mail->getMessage() . "</p>");

}

else {

echo("<p>Message successfully sent!</p>");

}

?>

Was this answer helpful?

Also Read

Adăugare redirecționări conturi de emailuri în cPanel

Creați o nouă redirecționare, selectând "Forwarders" din secțiunea "Email" din cPanel.Tot de aici...

Crearea / Stergerea unui Autoresponder

Crearea unui Autoresponder ! Pentru a crea un Autoresponder, întâi trebuie să vă logați în...

Create an email account

Below we describe the steps to create a new email address:1. Authentication - Log in to your...

Configure your email account on iOS (iPhone / iPad)

To manually configure your email account, make sure you know the email settings for your account,...

Error: "552 MS-Office file containing VBA macros found inside of the email"

Description      Error: "552 MS-Office file containing VBA macros found inside of the email"....