← Back
Editing: send.php
<?php $sitename = "http://www.smartmedia2000.it"; $thankspage = "http://www.smartmedia2000.it/php/thanks.htm"; $footer = "\n\nSent from $sitename"; $subject = "A postcard from your friend $your_name"; $intro = "Hi $friend_name,\nYour friend $your_name has sent you this message and postcard from our site.\n"; // start code: if (($your_name == '') || ($your_email == '') || ($friend_name == '')|| ($message == '')) { echo "<div align=center>You <b>must</b> fill out all the fields in the form. <a href=javascript:history.back(-1)>Return to the form</a>.</div>"; } else { # Check for valid email address $x = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$friend_email); if($x==0) # if no valid email address entered, display no email message { echo "<div align=center>You <b>must</b> specify a valid email address for your friend. <a href=javascript:history.back(-1)>Return to the form</a>.</div>"; } else { error_reporting(63); include('class.html.mime.mail.inc'); /*************************************** ** Read the chosen file into $attachment. ***************************************/ $filename = ($pic); $attachment = fread($fp = fopen($filename, 'r'), filesize($filename)); fclose($fp); /*************************************** ** Create the mail object. Optional headers ***************************************/ $mail = new html_mime_mail('X-Mailer: Html Mime Mail Class'); /*************************************** ** Create the message ***************************************/ $text = ''; $html = ($intro.$message.$footer); /*************************************** ** Add the text, html and embedded images. ***************************************/ $mail->add_html($html, $text); /*************************************** ** Add the attachment to the email. ***************************************/ $mail->add_attachment($attachment, ($pic), 'application/octet-stream'); /*************************************** ** Set Character Set ***************************************/ $mail->set_charset('iso-8859-1', TRUE); /*************************************** ** Builds message. ***************************************/ $mail->build_message(); /*************************************** ** Sends the message. ***************************************/ $mail->send(($friend_name), ($friend_email), ($your_name), ($your_email), ($subject)); // return thank you page for sender of the postcard header("Location: $thankspage"); } } ?>
Save File
Cancel