<?php
$to = "friend1@gmail.com,friend2@gmail.com,friend3@gmail.com,friendn@gmail.com";
$subject = "Anniversay Party";
$txt = "You are invited for a party with classical theme";
$headers = "From: myemail@gmail.com";
mail($to,$subject,$txt,$headers);
echo "<h1>MAIL SENT</h1>";
?>
我正在使用此脚本向我的朋友发送邮件,但是每个人都知道我邀请的是谁。
现在所有的电子邮件地址都显示在收件人的收件人字段中。
任何人都可以帮助我吗?
答案 0 :(得分:1)
<?php
$to = ["friend1@gmail.com", "friend2@gmail.com", "friend3@gmail.com", "friendn@gmail.com"];
$subject = "Anniversay Party";
$txt = "You are invited for a party with classical theme";
$headers = "From: myemail@gmail.com\r\n"; // I added \r\n for best practices
foreach ($to as $email)
mail($email, $subject, $txt, $headers);