jeliot Posted April 4, 2006 Share Posted April 4, 2006 I'm trying to write a script to collect email addresses from MySQL and send a generic email (possible a template with the ability to insert custom body) to everyone on the list.Here's what I've got so far<?//conects to the data base$db_host = "mysql";$db_user = "user";$db_pwd = "password";$db_name = "test";mysql_connect($db_host, $db_user, $db_pwd) or die(mysql_error());mysql_select_db($db_name) or die(mysql_error());//gets the data$data = mysql_query("SELECT * FROM test_list") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { $to = $info['email'];$subject = "Ggap Show Reminder";$body = "This is a test email for Ggap New Show Reminders";$headers = "From: [email protected]\n";mail($to,$subject,$body,$headers);echo "Mail sent to $to";</?obviously not a working script yet.........I KNOW i do need to somehow keep the header of the email from showing other on the list.Any Suggtions are welcomeThanks Link to comment https://forums.phpfreaks.com/topic/6526-php-mail-from-mysql-mailing-list/ Share on other sites More sharing options...
sanfly Posted April 4, 2006 Share Posted April 4, 2006 Check out the data about the mail function in the [a href=\"http://php.inspire.net.nz/manual/en/function.mail.php\" target=\"_blank\"]manual[/a] Link to comment https://forums.phpfreaks.com/topic/6526-php-mail-from-mysql-mailing-list/#findComment-23694 Share on other sites More sharing options...
jeliot Posted April 4, 2006 Author Share Posted April 4, 2006 [!--quoteo(post=361436:date=Apr 3 2006, 10:09 PM:name=sanfly)--][div class=\'quotetop\']QUOTE(sanfly @ Apr 3 2006, 10:09 PM) [snapback]361436[/snapback][/div][div class=\'quotemain\'][!--quotec--]Check out the data about the mail function in the [a href=\"http://php.inspire.net.nz/manual/en/function.mail.php\" target=\"_blank\"]manual[/a][/quote]Well I've been to the php manual and then to my yahoo host and back to the manual again and I've dwindled my scipt down to this<?$mail = "[email protected]";$subject = "test";$msg = "test email";$header = "From: [email protected]";mail($mail,$subject,$msg,$header);?>Thanks for the advice I've got the send mail part working now the part i dread is getting the info from the db and sending a mass email to everyoneIt seems like I may have to read a whole book on php just to use a few of the abbilities of php but I hope not................... Link to comment https://forums.phpfreaks.com/topic/6526-php-mail-from-mysql-mailing-list/#findComment-23871 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.