Error sending email - SMTP

0

I'm trying to send a verification email. But give me an error:

I have this code:     

/*Define constant to connect to database */
DEFINE('DATABASE_USER', 'root');
DEFINE('DATABASE_PASSWORD', '');
DEFINE('DATABASE_HOST', 'localhost');
DEFINE('DATABASE_NAME', 'forum');
/*Default time zone ,to be able to send mail */
date_default_timezone_set('UTC');

/*You might not need this */
ini_set('SMTP', "mail.myt.mu"); // Overide The Default Php.ini settings for   sending mail


//This is the address that will appear coming from ( Sender )
define('EMAIL', '[email protected]');

/*Define the root url where the script will be found such as    http://website.com or http://website.com/Folder/ */
DEFINE('WEBSITE_URL', 'http://localhost');


// Make the connection:
$dbc = @mysqli_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD,
DATABASE_NAME);

if (!$dbc) {
trigger_error('Could not connect to MySQL: ' . mysqli_connect_error());
} 

?>

And 'the first time I try to email php. Does anyone know the problem?

Warning: mail(): Failed to connect to mailserver at "mail.myt.mu" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\projects-Registration system Modify\index.php on line 69

I'm using easy php.

    
asked by anonymous 12.03.2016 / 18:32

1 answer

-2

This error occurs because you did not configure the local sending of SMTP. Although it is possible, I find it a waste of time. Because when you send to a server, this problem will no longer exist, as long as your code is clear.

If you really want to configure locally, a similar question is asked using PHPMailer:

How to send localhost email using the PHP mail function?

    
12.03.2016 / 19:50