Results 1 to 2 of 2

Thread: Updating an email message on the fly? (HELP)

  1. #1
    Join Date
    Nov 2002
    Posts
    3

    Updating an email message on the fly? (HELP)

    Hello, I've run into a bit of a problem. I have
    a MySQL database with a specific email message in
    it. In another part of my database I have a list
    of opt-in email addresses and first names.

    What I would like to do is personalize my message
    with the first name of each of the email addresses
    the message goes to where I have a <firstname>
    saved within the message.

    Is there an easy way to do this in my existing CGI
    code? Right now I just set the pointer to the
    current record, send the message to that record
    and advance to the next, etc...

    All this is done using:

    print MAIL "$message\n\n\n";

    Thank you!

  2. #2
    Join Date
    Dec 2002
    Location
    Cincinnati, OH
    Posts
    2
    It looks like you're using Perl. Once you have your message, just query out the names you want to add and loop through them. You'll want one variable that holds the original message and doesn't get modified. Then in your loop you'll say something like:

    ...
    while (($fname) = $sth->fetchrow_array)
    {
    $msg_tmp = $message;
    $msg_tmp =~ s/\<firstname\>/$fname/;
    print MAIL "$msg_tmp\n\n";
    }
    ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •