Error sending email - SMTP

Asked

Viewed 96 times

0

I am trying to send a verification email. But make 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());
} 

?>

It’s the first time I try to send an email by php. Someone knows 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\1-Registration system Modify\index.php on line 69

I’m using easy php.

1 answer

-2

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

If you really want to configure locally, follow a similar question with the use of Phpmailer:

How to send email from localhost using the PHP mail function?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.