0

i tried sending email using my php mail function but i get this warning during process

Warning: mail(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in

my problem is how do i fixed time for my php mail function to read out this warning on my php mail page this my code:

  $to      = xvy@gmail.com        $message = yes go email;
    $subject = 'the subject';
    $time = date_default_timezone_set('Africa/Lagos');
    $headers = 'From: stringemail@gm.Com';

    $go = mail($to, $subject, $message, $headers);
    if ($go)
    {
        echo 'good result';
    }

Big thank in advance

examma
  • 15
  • 5

1 Answers1

0

You need to define the timezone for the whole PHP environment.

You can do it within your script with PHP function date_default_timezone_set() with the timezone List of Supported Timezones:

 <?php 
 date_default_timezone_set('Africa/Lagos');
 // rest of your script goes here...
ino
  • 2,345
  • 1
  • 15
  • 27