$message = This is a Multipart Message in (Net web server)
$message = This is a Multipart Message in MIME formatn ; $message .= –$boundaryn ; $message .= Content-type: text/html; charset=iso-8859-1n ; $message .= Content-Transfer-Encoding: 7bitnn ; $message .= $confirmmessage . n ; $message .= –$boundaryn ; $message .= Content-Type: text/plain; charset= iso-8859-1 n ; $message .= Content-Transfer-Encoding: 7bitnn ; $message .= $textconfirm . n ; $message .= –$boundary– ; The variable $confirmmessage is the HTML version of the confirmation e-mail. The variable $text confirm is the plain-text version. The variable $message is the entire message, coded to send both plain and HTML e-mails. Note where you insert the $confirmmessage and $textconfirm variables in the multipart message. Finally, the following sends the e-mail. Don t be confused by the variable $from. That actually controls who this e-mail is being sent to. That s the whole idea behind sending out this confirmation e-mail. $mailsent = mail($from, $confirmsubject, $message, $headers); When the user receives the confirmation e-mail, there is a link at the bottom: $confirmmessage .= Click here to confirm ; When the user clicks the link, confirmmail.php is loaded in his or her browser, appended with ?id= plus the unique validation ID. This is used within confirmmail.php to access the proper postcard in the database, compose the e-mail, and send it on its way. A quick reminder: If you always set your variables like this, you never have to worry about the register_globals setting in your php.ini file. $id = $_GET[ id ]; The following gets all postcards that match your ID. Of course, there should always be just one match, because $id is unique. $sql = SELECT * FROM confirm WHERE validator = $id ; The array $pcarray contains all of the postcard data you need to send the postcard to its intended recipient: $query = mysql_query($sql, $conn) or die(mysql_error()); $pcarray = mysql_fetch_array($query); Here s a little insurance to make sure you don t try to send out a postcard if no postcard data exists. (Of course, you will think of a much more elegant error message, won t you?) This might be a good place for the PHP header() function to redirect the user to a more information error page. if (!is_array($pcarray)) { echo Oops! Nothing to confirm. Please contact your administrator ; exit; } 353 Sending E-mail
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.