I need help developing a script to basically take a query result and construct an HTML email and send each email with dynamic info from the query result. This is the breakdown of what I think I should be doing:

//OPEN DATABASE CONNECTION

//QUERY DATABASE FOR RECIPIENTS AND PERTINENT INFO

//LOOP THROUGH THE CREATION OF HTML EMAIL WITH QUERY RESULTS
!!!THE CREATION OF THE EMAIL IS WHERE I THINK I NEED THE REAL HELP!!!

//SEND EMAIL
mail($row["EMail"], $VSubject, $Body, "From: MYSITE.com <$VFrom>");

//PRINT CONFIMATION THAT MAIL HAS BEEN SENT TO RECIPIENT

//END LOOP

//END

If I have structured this script incorrectly so far, please correct me before it is too late.

But my real question is how do you create a HTML email through a PHP script and make it have the correct headers and also make sure that it has something, like an alternative email to display to those email programs that only view text?πŸ˜•

    One question about it though.

    If I want to mail an HTMN with txt backup do I use the Multipart structure?

    ex.

    $email=new email_multi("from@me.com", "Newsletter");
    $email->clean();
    $email->setheaders();

    /??Can I construct the HTML and txt email here and assign them to as a whole to a variable then put each variable in the addmessage() function??/

    $email->addmessage("$txtemail", "$htmlemail");
    $email->sendmail("$row["Email"]");

    Thanks already and even more in advance for your helpπŸ™‚

      Thats almost exactly right you just need to drop the speech marks

      $email=new email_multi("from@me.com", "Newsletter");

      // Any loop should start here.

      $email->clean();
      $email->setheaders();

      $textmessage="hello\n this is the text equivelent";
      $htmlmessage="<B>Hello</B><P>This is the html part";

      $email->addmessage($textmessage, $htmlmessage);
      $email->sendmail($row["Email"]);

      // end a loop here

      Then it will show html where html can be viewed and text anywhere else.

      Mark.

        You are the greatest.

        Thanks.

          Write a Reply...