Sending Dynamic Email to multiple and different users by retrieving Co

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 3206 Views - Last Post: 22 February 2011 - 08:53 AM Rate Topic: -----

#1 nandureddy  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 129
  • Joined: 31-January 11

Sending Dynamic Email to multiple and different users by retrieving Co

Posted 07 February 2011 - 10:50 PM

hi friends,

i am trying to write a php code , that sends emails to different users( the user list being retreived from mysql db ), their details (the details should also be retreived from the database) , just by clicking a single button..

example: sending user account details to respective accounts through email by clicking a submit button.


i finished writing codes for the email function and for retreiving the required details.
now i want to integrate both of them using loops or conditional statements.

please help..

thanks in advance

Is This A Good Question/Topic? 0
  • +

Replies To: Sending Dynamic Email to multiple and different users by retrieving Co

#2 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5411
  • View blog
  • Posts: 27,423
  • Joined: 10-May 07

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 07 February 2011 - 10:56 PM

View Postnandureddy, on 08 February 2011 - 12:50 AM, said:

i finished writing codes for the email function and for retreiving the required details.
now i want to integrate both of them using loops or conditional statements.

please help..

Reading the above, I'm curious what help you expect anyone to be able to deliver. You have to realize that we are not standing over your shoulder. We don't have access to your code. Best we can do is guess & that takes all of your work efforts out of it.

Please post your code (in code tags) & we'll be more than happy to help.
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3577
  • View blog
  • Posts: 10,442
  • Joined: 08-June 10

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 08 February 2011 - 12:22 AM

the SwiftMailer library offers a method (via the Decorator plugin) to fetch the addresses and details directly from the DB.
Was This Post Helpful? 0
  • +
  • -

#4 nandureddy  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 129
  • Joined: 31-January 11

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 08 February 2011 - 07:49 AM

View Postno2pencil, on 07 February 2011 - 10:56 PM, said:

View Postnandureddy, on 08 February 2011 - 12:50 AM, said:

i finished writing codes for the email function and for retreiving the required details.
now i want to integrate both of them using loops or conditional statements.

please help..

Reading the above, I'm curious what help you expect anyone to be able to deliver. You have to realize that we are not standing over your shoulder. We don't have access to your code. Best we can do is guess & that takes all of your work efforts out of it.

Please post your code (in code tags) & we'll be more than happy to help.



Hey, sorry, i was just expecting some one to post the logic, not the code, so i dint paste my code in the post.
sorry again.
will post my code soon
Was This Post Helpful? 0
  • +
  • -

#5 nandureddy  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 129
  • Joined: 31-January 11

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 20 February 2011 - 01:31 PM

View Postnandureddy, on 08 February 2011 - 07:49 AM, said:

View Postno2pencil, on 07 February 2011 - 10:56 PM, said:

View Postnandureddy, on 08 February 2011 - 12:50 AM, said:

i finished writing codes for the email function and for retreiving the required details.
now i want to integrate both of them using loops or conditional statements.

please help..

Reading the above, I'm curious what help you expect anyone to be able to deliver. You have to realize that we are not standing over your shoulder. We don't have access to your code. Best we can do is guess & that takes all of your work efforts out of it.

Please post your code (in code tags) & we'll be more than happy to help.



Hey, sorry, i was just expecting some one to post the logic, not the code, so i dint paste my code in the post.
sorry again.
will post my code soon



hi friends,

i dint finish the coding yet,but still working on the logic. please tell me if u think this works

function fetchandmail($userid)
	{
	
	$connection = dbConnect();
	mysql_select_db("dbname");
	/* an ldap function here */

               $details = mysql_query(" ",$connection) or die(mysql_error()); /* the above sql query get the user details (list of users from a category) from the db */


               $req_details = mysql_query (" ",$connection) or die(mysql_error()); /* the above sql query gets the individual users details based on the $details query. */


               $rows = mysql_num_rows($req_details);

                for($i=0;$i<1;$i++)
        {
               $output = mysql_fetch_array($req_details);
               $uniq_id = $output[0];
        /* calling the ldap function here again and retreiving the email address ( for example $email) */

                $user_name_details = mysql_fetch_array(mysql_query("",$connection)) or die(mysql_error());
        /* this is the query that gets the details based on the $req_details query */

                $from="";
                $to="$email";
                $subject="";

                $message= " /* the mysql query results (details from both the queries ,$req_details and $user_name_details) of 
"the particular user" should be sent as a message to the "particular $email" of that user */ ";

                $message = wordwrap($message,70);
                mail($to,$subject,$message,$from);
        }
                mysql_close();
        }




Was This Post Helpful? 0
  • +
  • -

#6 chinchang  Icon User is offline

  • Indie Game Developer
  • member icon

Reputation: 192
  • View blog
  • Posts: 725
  • Joined: 22-December 08

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 20 February 2011 - 02:24 PM

The program flow is almost rite.
- You connect to DB
- Get all rows
- For each row, fetch data
- Send mail using the above data

All that is needed is the correct code. You might want to check this for your sql queries and this for connecting to mysql.
Was This Post Helpful? 1
  • +
  • -

#7 nandureddy  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 129
  • Joined: 31-January 11

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 20 February 2011 - 03:44 PM

View Postchinchang, on 20 February 2011 - 02:24 PM, said:

The program flow is almost rite.
- You connect to DB
- Get all rows
- For each row, fetch data
- Send mail using the above data

All that is needed is the correct code. You might want to check this for your sql queries and this for connecting to mysql.


Hey, thanks for the reply.
i tested the code, the syntax is correct and working. i tested with my email and i am getting the data of the users as an email. i want to know whether it works if i directly call their email and assign it to $email. i want to send their data to their respective email..
Thanks..
Was This Post Helpful? 0
  • +
  • -

#8 nandureddy  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 129
  • Joined: 31-January 11

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 21 February 2011 - 11:36 PM

View Postnandureddy, on 20 February 2011 - 03:44 PM, said:

View Postchinchang, on 20 February 2011 - 02:24 PM, said:

The program flow is almost rite.
- You connect to DB
- Get all rows
- For each row, fetch data
- Send mail using the above data

All that is needed is the correct code. You might want to check this for your sql queries and this for connecting to mysql.


Hey, thanks for the reply.
i tested the code, the syntax is correct and working. i tested with my email and i am getting the data of the users as an email. i want to know whether it works if i directly call their email and assign it to $email. i want to send their data to their respective email..
Thanks..

Hi friends, someone please check my code and tell me if the logic works..
Thanks in advance..
Was This Post Helpful? -2
  • +
  • -

#9 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6111
  • View blog
  • Posts: 23,671
  • Joined: 23-August 08

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 22 February 2011 - 04:42 AM

Test your own code...we're not your QA department.
Was This Post Helpful? 1
  • +
  • -

#10 nandureddy  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 129
  • Joined: 31-January 11

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 22 February 2011 - 07:23 AM

View PostJackOfAllTrades, on 22 February 2011 - 04:42 AM, said:

Test your own code...we're not your QA department.

hi JackOfAllTrades, i was not asking someone to "Test" my code. i was just asking suggestions regarding the logic.
i wasn't expecting someone to test my code...

thanks..
Was This Post Helpful? 0
  • +
  • -

#11 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6111
  • View blog
  • Posts: 23,671
  • Joined: 23-August 08

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 22 February 2011 - 07:39 AM

Quote

Hi friends, someone please check my code and tell me if the logic works..


Don't know what planet YOU are from, but here on Earth that request translates to "test my code for me"
Was This Post Helpful? 0
  • +
  • -

#12 nandureddy  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 129
  • Joined: 31-January 11

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 22 February 2011 - 07:46 AM

View PostJackOfAllTrades, on 22 February 2011 - 07:39 AM, said:

Quote

Hi friends, someone please check my code and tell me if the logic works..


Don't know what planet YOU are from, but here on Earth that request translates to "test my code for me"


Ok,
YOU can read the first post of the thread, i was just asking about the working of the logic, i dint expect someone to give the code for me. ( i know about DIC rule- Don't Tell Us To Give You Code!).
Was This Post Helpful? -2
  • +
  • -

#13 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10819
  • View blog
  • Posts: 40,334
  • Joined: 27-December 08

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 22 February 2011 - 07:46 AM

Run your code. If it works as you expected, then your logic is probably fine. :)
Was This Post Helpful? 2
  • +
  • -

#14 nandureddy  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 129
  • Joined: 31-January 11

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 22 February 2011 - 07:52 AM

View Postmacosxnerd101, on 22 February 2011 - 07:46 AM, said:

Run your code. If it works as you expected, then your logic is probably fine. :)


Thanks macosxnerd101, for the instant reply.
i have a doubt regarding the for loop. i tested it with my email, its working fine. i want to declare a $email and assign the $to to that $email, so that the user data that is retreived from the db, should be sent to the $email of that 'particular' user.

Thanks...
Was This Post Helpful? 0
  • +
  • -

#15 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10819
  • View blog
  • Posts: 40,334
  • Joined: 27-December 08

Re: Sending Dynamic Email to multiple and different users by retrieving Co

Posted 22 February 2011 - 07:58 AM

So $to = $user_name_details['email_field_in_database'];.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2