There are multiple ways you can send an email to customers retrieved from database. In this article I’ll explain the code that I wrote to bulk send an email to the list of customers retrieved from MySQL database.
PHP script to send an Email
Smallest code you can write to send an email using PHP is below
<?php $to = "recipient email"; $subject = "Subject for the email"; $body = "Hi test person, This is test email."; $header = "From: from@email"; if ( mail($to, $subject, $body, $header)) { echo("Success"); } else { echo("Failed"); } ?>
Now lets extend this code to send the email to list of customers. We will retrieve the list of customers from MySQL databse.
... Read More