"; $html_msg .= ""; $html_msg .= "
Greetings, $toname!"; $html_msg .= "
"; $html_msg .= "$fromname has sent you a postcard today.
Enjoy!"; $html_msg .= "
"; $html_msg .= ""; $html_msg .= "
"; $html_msg .= $messagebody . "\n"; $html_msg .= "
"; $temp=gettimeofday(); $msec=(int)$temp["usec"]; $msgid = md5(time() . $msec); $conn = mysql_connect("yourserver", "joeuser", "yourpass"); mysql_select_db("postcard", $conn); $sql = "INSERT INTO confirm (validator, to_e-mail, toname, from_e-mail, fromname, bcc_e-mail, cc_e-mail, subject, postcard, message) VALUES (\"$msgid\", \"$to\", \"$toname\", \"$from\", \"$fromname\", \"$bcc\", \"$cc\", \"$subject\", \"$postcard\", \"$messagebody\")"; $query = mysql_query($sql, $conn) or die(mysql_error()); $confirmsubject = "Please Confirm your postcard"; $confirmmessage = "Hello " . $fromname . ",\n\n"; $confirmmessage .= "Please click on the link below to confirm that you would like to send this postcard:\n\n"; $confirmmessage .= $html_msg . "\n\n"; $confirmmessage .= "Click here to confirm"; $textconfirm = "Hello " . $fromname . ",\n\n"; $textconfirm .= "Please visit the following URL to confirm your postcard:\n\n"; $textconfirm .= "http://localhost/wrox/confirmmail.php ?id=\"$msgid\""; $message = "This is a Multipart Message in MIME format\n"; $message .= "--$boundary\n"; $message .= "Content-type: text/html; charset=iso-8859-1\n"; $message .= "Content-Transfer-Encoding: 7bit\n\n"; $message .= $confirmmessage . "\n"; $message .= "--$boundary\n"; $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $message .= "Content-Transfer-Encoding: 7bit\n\n"; $message .= $textconfirm . "\n"; $message .= "--$boundary--"; $mailsent = mail($from, $confirmsubject, $message, $headers); if ($mailsent) { echo "Here is the postcard you wish to send.
"; echo "A confirmation e-mail has been sent to $from.
"; echo "Open your e-mail and click on the link to confirm that you would like to send this postcard to $toname.

"; echo "Subject: $subject
"; echo "Message:
"; echo $html_msg; } else { echo "There was an error sending the e-mail."; } ?>