Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-31-2009, 10:06 AM   PM User | #1
noisyscanner
New Coder

 
Join Date: May 2009
Location: Glastonbury, UK
Posts: 53
Thanks: 1
Thanked 0 Times in 0 Posts
noisyscanner is an unknown quantity at this point
How to separate email addresses and mail to them.

Hi there,
I am trying to write a script that will get all data from mysql dtabase where user_actived = 0.
I then want my script to send an email to those people.
The problem is when I echo what it has returned i get something like this:
Quote:
somebody@somehost.comsomebodyelse@thishost.co.uk
How would i seperate the email adddresses and then mail an email to each of them.
Thanks
Noisyscanner
noisyscanner is offline   Reply With Quote
Old 05-31-2009, 10:22 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Can you post your php code on how you are getting the results? Is likely just a html issue.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 05-31-2009, 10:53 AM   PM User | #3
noisyscanner
New Coder

 
Join Date: May 2009
Location: Glastonbury, UK
Posts: 53
Thanks: 1
Thanked 0 Times in 0 Posts
noisyscanner is an unknown quantity at this point
PHP Code:
<?php
mysql_connect
("localhost""myusername""mypassword") or die(mysql_error());
mysql_select_db("mydatabase") or die(mysql_error());
$select_game mysql_query("SELECT * FROM users WHERE user_activated = '0'");
while(
$row mysql_fetch_array$select_game )) {
echo(
$row['user_email']);
$message 
"Thank you for registering an account with Universalgames.\n
You have not yet activated your account, so you will not be able to log in to Universalgames.\n
Please activate it by clicking below:
http://mysite.com/activate.php
_____________________________________________
This is an automated response. PLEASE DO NOT REPLY.
"
;

    
mail($row['user_email'] , "Universalgames account activation"$message,
    
"From: \"Universalgames\" <accounts@$host>\r\n" .
     
"X-Mailer: PHP/" phpversion());
}
?>

Last edited by noisyscanner; 05-31-2009 at 11:41 AM..
noisyscanner is offline   Reply With Quote
Old 05-31-2009, 11:01 AM   PM User | #4
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Yeah see this is all you are doing
PHP Code:
echo($row['user_email']); 
just change that to this
PHP Code:
echo $row['user_email'].'<br>'
They are already "separated". I suggest you remove your personal information from your post.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Users who have thanked _Aerospace_Eng_ for this post:
noisyscanner (05-31-2009)
Old 05-31-2009, 11:03 AM   PM User | #5
noisyscanner
New Coder

 
Join Date: May 2009
Location: Glastonbury, UK
Posts: 53
Thanks: 1
Thanked 0 Times in 0 Posts
noisyscanner is an unknown quantity at this point
Thanks now it is all echoed on a new line.
Would my mail function now work?
noisyscanner is offline   Reply With Quote
Old 05-31-2009, 11:23 AM   PM User | #6
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
It should have already been working. As the emails were different each time the mail function was called. If its not working then there is something wrong with your server.

Add this after <?php
PHP Code:
ini_set('display_errors','1');
error_reporting(E_ALL); 
Let us know what you get and you STILL didn't remove your username and password from your post.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 05-31-2009, 05:18 PM   PM User | #7
noisyscanner
New Coder

 
Join Date: May 2009
Location: Glastonbury, UK
Posts: 53
Thanks: 1
Thanked 0 Times in 0 Posts
noisyscanner is an unknown quantity at this point
Ok thanks all is working now!!
noisyscanner is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:14 AM.


Advertisement
Log in to turn off these ads.