runnerjp Posted August 26, 2008 Share Posted August 26, 2008 i store my users emails on signup in my db... but i was wondering how i could send 1 email to them all ?? would the names have to be sepreated by , or anything of sort? Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/ Share on other sites More sharing options...
zq29 Posted August 26, 2008 Share Posted August 26, 2008 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-626280 Share on other sites More sharing options...
runnerjp Posted August 26, 2008 Author Share Posted August 26, 2008 u mean yes seperated by a ,... is there a limit to amount of users it can be sent too> Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-626281 Share on other sites More sharing options...
runnerjp Posted August 27, 2008 Author Share Posted August 27, 2008 bmp Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-626842 Share on other sites More sharing options...
DeanWhitehouse Posted August 27, 2008 Share Posted August 27, 2008 yes and not technically, there is no limit but the script may time out if you use standard mail to send one emails to lots of people. Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-626846 Share on other sites More sharing options...
runnerjp Posted August 27, 2008 Author Share Posted August 27, 2008 ok you may know what my next question will be... so basicly i have to loop the emails and then send it via what (whats other then standerd mail ??) Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-626851 Share on other sites More sharing options...
DeanWhitehouse Posted August 27, 2008 Share Posted August 27, 2008 I think phpmailer would be a good choice, and loop through each recipicent and send the email, or i think it is called PEAR::Mail or similar. http://uk.php.net/function.mail Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-626868 Share on other sites More sharing options...
runnerjp Posted August 27, 2008 Author Share Posted August 27, 2008 ok would it go something like <?php mysql_select_array() while { if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $useremail //taken from db ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail( "someone@example.com", "Subject: $subject", $message, "From: $email" ); echo "email sent"; }} else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-627127 Share on other sites More sharing options...
DeanWhitehouse Posted August 27, 2008 Share Posted August 27, 2008 no , do something like for($to as $to1) { mail( $to1, "Subject: $subject", $message, "From: $email" ); } that will be for multiple emails Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-627143 Share on other sites More sharing options...
runnerjp Posted August 27, 2008 Author Share Posted August 27, 2008 ok... so wuld it be at the top <?php $sql = "SELECT email FROM users"; $data = mysql_query( $sql ) or die( "Could not get threads" ); while ( $data2 = mysql_fetch_array( $data ) ) { $to = $data2; } ?> then that would be the for($to as $to1) Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-627245 Share on other sites More sharing options...
runnerjp Posted August 28, 2008 Author Share Posted August 28, 2008 bmp Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-628216 Share on other sites More sharing options...
BlueSkyIS Posted August 28, 2008 Share Posted August 28, 2008 yes. Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-628234 Share on other sites More sharing options...
runnerjp Posted August 29, 2008 Author Share Posted August 29, 2008 what is the $to1 tho Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-629198 Share on other sites More sharing options...
DeanWhitehouse Posted August 30, 2008 Share Posted August 30, 2008 soz that should be foreach($to as $to1) { mail($to1, "Subject: $subject", $message, "From: $email" ); } and the $to1 , is the var that is created for each email. Quote Link to comment https://forums.phpfreaks.com/topic/121448-emailing-users/#findComment-629324 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.