Search code examples
phpmysqlphpmailerphplist

How to send personalized email in phplist


Is there a way that I can send personalized emails to different users on the same list in phplist? for example i composed this message:

Dear [name] This is the content

If there is a way to modify the [name] to send emails with the actual name of the recipient how can I do it?

Thanks


Solution

  • As you store the user list on a MySQL database, so just simply select the users from the database, and then send a mail to every user on each round of the loop, using result from the query. For example,

    <?php
        $result = mysql_query("SELECT * FROM mail_list");
        while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
            $message = "Dear $row['username']";
            $message .= "More...";
            $phpmailer->mail($row['email'], $message, $header); // just for example
        }
    ?>
    

    Figure it out yourself, the code might not fit your context, good luck (: