1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php mail script

Discussion in 'PHP' started by Alex Petrus, Aug 3, 2013.

  1. #1
    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.
     
    Alex Petrus, Aug 3, 2013 IP
  2. ekim941

    ekim941 Member

    Messages:
    74
    Likes Received:
    7
    Best Answers:
    7
    Trophy Points:
    33
    #2
    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.
     
    ekim941, Aug 4, 2013 IP
    liamwli likes this.
  3. Hectorix

    Hectorix Member

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #3
    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?
     
    Hectorix, Aug 5, 2013 IP
  4. marht

    marht Active Member

    Messages:
    142
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    58
    #4
    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
     
    marht, Aug 6, 2013 IP
  5. Jelenik

    Jelenik Well-Known Member

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    126
    #5
    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...
     
    Jelenik, Aug 7, 2013 IP
  6. TokensLive.Com

    TokensLive.Com Greenhorn

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #6
    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
     
    TokensLive.Com, Aug 11, 2013 IP
  7. xyzseo

    xyzseo Greenhorn

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    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.
     
    xyzseo, Aug 28, 2013 IP