• Publicidad

No llega el correo con el contenido del formulario

¿Apenas comienzas con Perl? En este foro podrás encontrar y hacer preguntas básicas de Perl con respuestas aptas a tu nivel.

No llega el correo con el contenido del formulario

Notapor adolfopar » 2008-12-03 03:41 @195

Hola,

Tengo el siguiente archivo cgi con código fuente en Perl y a pesar de que me aparece el mensaje "Pedido transmitido correctamente", no recibo nada por correo electrónico. ¿Alguien sabe porqué ?. Muchas gracias.

Mi servidor me ha dado esta dirección ( "/var/qmail/bin/qmail-inject ) en lugar de usr/bin/sendmail y desde ese momento me aparece el mensaje de pedido enviado, pero no llega nada.

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
#!/usr/bin/perl
#

$mailprog = "/var/qmail/bin/qmail-inject";

&ReadParse;
&processOrder;
&print_danke;
exit(0);

sub processOrder {
$boundary = time;
@str = ();
push(@str,"| $mailprog -t");
$- = 0;
foreach $str (@str) {
open(FILE, $str) || &return_failed_file_open($str);
print FILE "To: $in{'To'} ";
print FILE "From: $in{'From'} ";
print FILE "Reply-To: $in{'From'} ";
print FILE "Subject: $in{'Subject'} ";
print FILE "X-Mailer: www.mi-tiendaweb.com E-Mail-Client Version 1.0 ";
print FILE "MIME-Version: 1.0 ";
print FILE "Content-Type: multipart/mixed; boundary="_" . $boundary . "_" ";
print FILE "--_" . $boundary . "_ ";
print FILE "Content-Type: text/plain; charset="us-ascii" ";
print FILE "$in{'Message'} ";
print FILE "--_" . $boundary . "_ ";
print FILE "Content-Type: text/plain; charset="us-ascii" ";
print FILE "Content-Disposition: attachment; filename="order" . $boundary . ".osm" ";
print FILE "$in{'Attachment'} ";
print FILE "--_" . $boundary . "_ ";
close(FILE);
}
}

sub print_danke {
print "Content-type: text/html ";
print qq|
<html>
<head>
<title>$in{'Subject'}</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" OnLoad="self.focus()">
<center>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td align="center">
<form>
<font face="Arial, Helvetica, sans-serif" size="2"><b>Pedido transmitido correctamente.</b>
<p><input type="button" value="OK" onclick="self.close()"></p>
</form>
</td>
</tr>
</table>
</center>
</body>
</html>
|;
}

sub return_failed_file_open {
print "Content-type: text/html ";
print "Couldn't open file $_[0]: $!";
exit(1); }

sub ReadParse {
if (@_) {
local (*in) = @_;
}
local ($i, $loc, $key, $val);
# Read in text
if ($ENV{'REQUEST_METHOD'} eq "GET") {
$in = $ENV{'QUERY_STRING'};
} elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $in, $ENV{'CONTENT_LENGTH'});
}
# Puffern des Input
$in_buffer = $in;
@in = split(/&/,$in);
foreach $i (0 .. $#in) {
# Convert plus's to spaces
$in[$i] =~ s/+/ /g;
# Convert %XX from hex numbers to alphanumeric
$in[$i] =~ s/%(..)/pack("c",hex($1))/ge;
# Split into key and value.
$loc = index($in[$i],"=");
$key = substr($in[$i],0,$loc);
$val = substr($in[$i],$loc+1);
$in{$key} .= '' if (defined($in{$key})); # is the multiple separator
$in{$key} .= $val;
}
return 1; # just for fun
}
Coloreado en 0.006 segundos, usando GeSHi 1.0.8.4
adolfopar
Perlero nuevo
Perlero nuevo
 
Mensajes: 1
Registrado: 2008-12-02 13:05 @586

Publicidad

Notapor explorer » 2008-12-03 06:18 @304

Bienvenido a los foros de Perl en Español, adolfopar.

Y, simplemente, con el uso del qmail-inject, ¿es suficiente para enviar correo electrónico? ¿el servidor de correo no requiere autenticación?

¿Has probado a enviarte un correo a ti mismo o, mejor, enviar un correo al mismo dominio al que pertenece el servidor?
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España


Volver a Básico

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 11 invitados

cron