we have the following table database with following cells: 1.client name 2.client email 3.products ordered I want to use a php script that sends email to client with the products he ordered... the email should send only when a client is added in the database.
Are you looking for a quote or help with your code? If your code isn't working, you can post it here and we can help you work out the bugs. But, without any code, we can't tell what the trouble is.
You can use phplist.com to send newsletter. But in your case you should write (or find) a php module. It's simple. What CMS do you use?
Hi Alex Petrus, I could write you a custom script within one week, but I will need to take a closer look to your code and this will require some time. You can request a quote through a private message if you would like. Kind regards, Maarten
It's not the best table schema for storing clients and ordered products. It should be separated - in one table clients (name, email), in second table relationship between client and ordered product (client_id, ordered_product_id)... but anyway I would do that like this: 1. connect to your database 2. loop all rows from your table 3. add ordered item from that row in array $ordered_items[$key_client_name_client_email]->items 4. save info about client in array $ordered_items[$key_client_name_client_email]->client_info 5. loop all clients from $ordered_items[$key_client_name_client_email] 6. in each loop you can get info about current client from that array, and you can loop all products for that client and create string of text (just don't forget to empty that string on begining of client loop), where would be all product info stored and after you have created string with all ordered products, then just send email with that text with your preffered method Without knowing anything more, we can't help you more...
Everyone has different learning methods when learning a language, and program languages are just the same. Take me for example, I can not learn from all the explanations above, I need to see examples. Here is my example, I hope it help... $to = "client email goes here"; $from = "your email goes here"; $subject = "Subject of email"; //Begin HTML Email Message where you need to change the activation URL inside $message = '<html> <body bgcolor="#FFFFFF"> Hi client name, <br /><br /> Your message </body> </html>'; // end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; // Finally send the activation email to the member mail($to, $subject, $message, $headers); Please put this code in the same place where you are inputting user information into the database
How many clients do U have in database? Be careful, if more than 100-1000 and You want sending emails everyday check Your server limit, because all servers allow X emails per day.