Me bajé un script el cuál funciona como servicio para enviar tarjetas postales electronicas (ecards) desde un sitio web donde la imagen la adjunta automáticamente en el correo del destinatario. Según tengo entendido utiliza sólo php para que funcione y el HTML Mime Mail class.
Es un script algo viejo (2001) y la página original ya no lo 'representa' como si nunca hubiera existido, je. Pero lo he visto funcionar correctamente por ejemplo en este sitio: http://avel.altervista.org/cardfoto/foto2.php
Pues no sé cuál pueda ser el problema en realidad, pero a la hora de intentar enviar la postal, me lleva a la página de error, de que no se llenaron todos los campos.
si alguien pudiera decirme qué sucede y como solucionarlo, le agradecería muchísimo.
Aquí pueden ver mi problema (intenten enviarse una postal a ustedes mismos) http://topiz.totalh.com/postalesss
el código php:
Código PHP:
<?php
##############################################################################
# Easy Postcard Version 1.2 #
# Copyright 2001 DotDragNet [email protected] #
# PHP, Flash, ASP and Perl from http://www.dotdragnet.co.uk/ #
##############################################################################
# This script is copyright 2001, [email protected] www.dotdragnet.co.uk #
# #
# COPYRIGHT NOTICE #
# Copyright 2001 DotDragNet.co.uk All Rights Reserved. #
# #
# This script may be used and modified free of charge by anyone so long as #
# this copyright notice and the comments above remain intact. By using this #
# script and its associated files, you agree to indemnify DotDragNet and all #
# other interested parties from any liability that might arise from it's use.#
# #
# Selling the code for this program without prior written consent is #
# expressly forbidden. Obtain permission before redistributing this #
# script over the Internet or in any other medium. In all cases copyright #
# and header must remain intact. #
# #
# Stipulations for use of this script: #
# 1. You must retain a live link to http://www.dotdragnet.co.uk from #
# the page which calls the PHP script (normally the "form" page), #
# unless you have express permission to remove it (just ask) :) #
# 2. We would love for you to let us know where the script is being used #
# so that we may direct people to your site to see it in use. #
# #
# DotDragNet also requests that should you make any improvements to this #
# script, please be kind enough to let us know so that we may improve ours #
# for the rest of the people who use it. #
##############################################################################
// set variables used in this PHP file:
$sitename = "http://blablabla.com/postales";
$thankspage = "thanks.htm";
$footer = "<br><br><hr><small><font face=verdana color=gray size=1pt>+++ Postal enviada desde $sitename - Gracias!</font></small>";
$subject = "$your_name te ha enviado una postal !!";
$intro = "<small><font face=verdana color=gray size=1pt>Hola $friend_name!,<br>Tu amigo/a $your_name te ha enviado una postal y un mensaje desde <b>Blablabla</b>!!</font></small><hr><font face=verdana color=gray size=1pt>Mensaje:</font><br><br>";
// start code:
if (($your_name == '') || ($your_email == '') || ($friend_name == '') || ($message == ''))
{
echo "<div align=center><font face=verdana color=gray size=1pt><b>Debes</b> llenar todos los campos del formulario. <a href=javascript:history.back(-1)><font color=gray>« Regresar</font></a>.</font></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><font face=verdana color=gray size=1pt><b>Debes</b> especificar un email válido para tu amigo/a. <a href=javascript:history.back(-1)>« Regresar</a>.</font></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");
}
}
?>
gracias!