Does php mail send emails in the background?

Asked

Viewed 54 times

-1

I’m developing a system where I send email to several users, where it sends the email and changes the SEND column in the data stack to true with a range of 10 seconds between each shipment. So I tried to simulate a power outage, and my perception would be. " Well lacked power so it will stop sending emails and also will not change the column in mysql". However what I realized and that even with the closed browser he still kept doing the loop, sending the email and updating the column in mysql, so clearly think, this is great, and came to me the curiosity, php and mysql in the case continue to work in the background, I mean with the whole system closed? Just one remark, I’m newly born in PHP

Follow the code:

foreach ($result as $key => $value) {
    $nameUser = $value['userName'];
    $email = $value['userEmail'];
    $headers = "From:  $nameD  $addressee \r\n";
    $headers .= "Return-Path: $nameD  $addressee \r\n";
    $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
    $html = str_replace("true", "false", $bodyEmail);
    mail($email, '=?UTF-8?B?' . base64_encode($subjects) . '?=', str_replace("nomedousuario", "$nameUser", $html), $headers);
    $update = $conn->prepare("UPDATE $tableName SET send = 'true', selectionType = 'noSelect'   WHERE userEmail = '$email'");
    $update->execute();
    sleep(10);
}

1 answer

-1

It continued running even after the browser was closed, as you had already made the request and what runs PHP is the apache server. If you want to stop sending just turn off the apache server that PHP stops running.

  • Wrong is not, I do not understand why so much negative...

  • much less me...

Browser other questions tagged

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