Код функции php mail () отправляет электронную почту один раз на определенный адрес электронной почты - PullRequest
0 голосов
/ 30 ноября 2018

Простой код функции php mail () для проверки почтовой программы на моем сайте, но он отправил сообщение только один раз, пожалуйста, что я сделал не так?

<?php
    ini_set( 'display_errors', 1 );
    error_reporting( E_ALL );
    $from = "info@companyemail.com";
    $to = "mypersonal@gmail.com";
    $subject = "Checking PHP mail";
    $message = "The PHP mail works just fine you should see it in your inbox";
    $headers = "From:" . $from;
    mail($to,$subject,$message, $headers);
    echo "The email message was sent.";
?>

1 Ответ

0 голосов
/ 30 ноября 2018

Здесь вам нужно добавить условия в цикле while, пройдите по приведенному ниже коду.

$i = 0;
while ($i < 10) //provide as many as mail are you sending,like it will sends 10 times.
{ 
    ini_set( 'display_errors', 1 );
    error_reporting( E_ALL );
    $from = "info@severnfundingninvestment.com";
    $to = "ogukingsley@gmail.com";
    $subject = "Checking PHP mail";
    $message = "The PHP mail works just fine you should see it in your inbox";
    $headers = "From:" . $from; mail($to,$subject,$message, $headers);
    echo "The email message was sent.";
    $i = $i + 1;
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...