Simple Postcards
parts=array(); $this->to= ""; $this->from= ""; $this->subject= ""; $this->body= ""; $this->headers= ""; } function add_attachment($message,$name= "",$ctype= "application/octet-stream") { $this->parts[]=array( "ctype"=>$ctype, "message"=>$message, "encode"=>$encode, "name"=>$name ); } function build_message($part) { $message=$part[ "message"]; $message=chunk_split(base64_encode($message)); $encoding= "base64"; return "Content-Type:".$part[ "ctype"]. ($part[ "name"]? ";name=\"".$part[ "name"]. "\"": ""). "\nContent-Transfer-Encoding:$encoding\n\n$message\n"; } function build_multipart() { $boundary= "b".md5(uniqid(time())); $multipart= "Content-Type:multipart/mixed;boundary=$boundary\n\nThisisaMIMEencodedmessage.\n\n--$boundary"; for($i=sizeof($this->parts)-1;$i>=0;$i--) { $multipart.= "\n".$this->build_message($this->parts[$i]). "--$boundary"; } return$multipart.= "--\n"; } function send() { $mime= ""; if(!empty($this->from)) $mime.= "From:".$this->from. "\n"; if(!empty($this->headers)) $mime.=$this->headers. "\n"; if(!empty($this->body)) $this->add_attachment($this->body, "", "text/plain"); $mime.= "MIME-Version:1.0\n".$this->build_multipart(); return(mail($this->to,$this->subject, "",$mime)); } }; ?> 0) { echo "You must enter an e-mail address for the recipient.
"; $errors++; } if (! strlen($from) > 0) { echo "You must enter your e-mail address.
"; $errors++; } if (! strlen($subject) > 0) { echo "You must enter a subject for the e-mail.
"; $errors++; } if (! strlen($message) > 0) { echo "You must enter some kind of message for the recipient.
"; $errors++; } if (! $fp = @fopen($postcard,"r")) { echo "You must select a postcard from the left.
"; $errors++; } if ($errors == 0) { $attachment=fread($fp,filesize("$postcard")); $mail=new mime_mail(); $mail->from="$from"; $mail->to="$to"; $mail->subject=stripslashes($subject); $mail->body=stripslashes($message); $mail->add_attachment("$attachment","$postcard","image/jpeg"); if ($mail->send()) { //if successful then writes info to a log file called log.txt. $today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm $filePointer = fopen("log.txt", "a"); fputs($filePointer, "$today\t\t$from has sent this email to $to.\n"); print ("Your email has been successfully sent!\n"); } else { print ("Your email has been not been successfully sent because of a system error!\n"); } } } ?>

Pick a postcard, fill out the information in the form boxes and click send! Make someone happy.


Butterfly

Please fill out all of the information below.

Recipient's Email:

Your Email:

Subject of Email:

Text of Message: