我在向电子邮件列表(文本文件)发送邮件时遇到问题。
代码:
<?php
$to="emails.txt";
$subject="Hey";
$txt="Hello...";
mail($to,$subject,$txt);
?>
我没有任何语法错误.... msg没有发送到电子邮件列表,这就是这里的问题
请建议并致谢
答案 0 :(得分:0)
如果你有一个txt文件,其中新行中的每个电子邮件地址,你可以这样做:
data
答案 1 :(得分:0)
$to
variable in your code contains the text only from the file name, but not the details of it. To be successful, you need to get data from a file and run them by sending a letter to each.
function file()
reads a file into an array, and FILE_IGNORE_NEW_LINES
key removes the line break charset value of each row. Thus it is possible to obtain an array of emails.
$arrayTo = file("file.txt", FILE_IGNORE_NEW_LINES);
$subject="Hey";
$txt="Hello...";
foreach($arrayTo as $to){
mail($to,$subject,$txt);
}