before I post this thread, I search my question, but I see only how to get recipients from database or other is with only mail() function.
I want to send emails from txt file, but my code send only first email from text document.
<?php
include("msd/mail.php");
$file = fopen("emails.txt", "r");
$line = fgets($file);
$to = $line;
$subject = "Approve your signup";
$body = "Hello, to approve your registration please click this link";
$mail = new Mail();
$mail->CharSet = 'UTF-8';
$mail->FromName = "myweb.com";
$mail->addAddress($to);
$mail->subject($subject);
$mail->body($body);
if(!$mail->send())
{
echo "Error Sending Email!";
}
else
{
echo "Mail sent!";
}
?>
emails.txt
test@gmail.com
test2@gmail.com
test3@gmail.com