Mailing database-input after storing in DB

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nosferatum

    Mailing database-input after storing in DB

    I have a registration form using php to process it and store values in
    MySQL. That works. But I also would like to get a mail with each
    registration input into the database. Anyone with any tip on where to
    add this code in the insert-script? At the very beginning, in the
    middle, or at the end? And will this piece of code actually mail me
    each input? I can't get it to work.

    if (phpversion() "4.0.6") {
    $HTTP_POST_VARS = &$_POST;
    }
    if (isset($HTTP_PO ST_VARS["tipsViaEpo st"])) {
    // make email info
    $to =
    "my_first_email @something.com, my_second_email @somethingelse. com";
    $subject = "New registration";
    $from = "From: Registration DB\r\n";
    $body = "Details stored in db:-\n\n";
    while (list($key,$val ue) == each($HTTP_POST _VARS)) {
    $body.= $key . " = " . $value . "\n";
    }

    // now send the mail
    mail($to,$subje ct,$body,$from) ;

    // then redirect to another page
    header("Locatio n: registrationSen t.php");
    }
  • Steve

    #2
    Re: Mailing database-input after storing in DB

    On Mar 10, 1:44 pm, Nosferatum <John.Ola...@gm ail.comwrote:
    I have a registration form using php to process it and store values in
    MySQL. That works. But I also would like to get a mail with each
    registration input into the database. Anyone with any tip on where to
    add this code in the insert-script? At the very beginning, in the
    middle, or at the end? And will this piece of code actually mail me
    each input? I can't get it to work.
    >
    if (phpversion() "4.0.6") {
    $HTTP_POST_VARS = &$_POST;}
    >
    if (isset($HTTP_PO ST_VARS["tipsViaEpo st"])) {
    // make email info
    $to =
    "my_first_em... @something.com, my_second_em... @somethingelse. com";
    $subject = "New registration";
    $from = "From: Registration DB\r\n";
    $body = "Details stored in db:-\n\n";
    while (list($key,$val ue) == each($HTTP_POST _VARS)) {
    $body.= $key . " = " . $value . "\n";
    >
    }
    >
    // now send the mail
    mail($to,$subje ct,$body,$from) ;
    >
    // then redirect to another page
    header("Locatio n: registrationSen t.php");
    >
    }
    Is your sendmail configured or set up? Try sending a test mail from
    the command line.
    SOme mailers wont let you put multiple addresses in the 'to'
    parameter. You might also want to try sending the mail to each
    recipient separately.

    Comment

    Working...