phpcode Posted May 17, 2010 Share Posted May 17, 2010 mail($to,$subject,$body,"From: $headers"); I want to create a mailing list for my members and make my code get each email from a text file. The emails in the text file will be like this: [email protected] [email protected] Could someone show me how I could make it go through each email? Link to comment https://forums.phpfreaks.com/topic/202004-mail-from-a-text-file/ Share on other sites More sharing options...
kenrbnsn Posted May 17, 2010 Share Posted May 17, 2010 Read the file into an array and then send in a loop: <?php $addrs = file('email_addresses.txt'); foreach($addrs as $addr) { mail(trim($addr),$subject,$body,$headers); } ?> ken Link to comment https://forums.phpfreaks.com/topic/202004-mail-from-a-text-file/#findComment-1059316 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.