Hi, guys,
I have a CGI Perl Script which runs in a Linux Server with Sendmail. This Scripts subroutine which effective sends the email, is this part below. It works fine, it is quite simple. Well, now I need to include two functions in this sending:
1) First, I need to attach to this email a file which also is in the same server, called, say, image.jpg.
2) And secondly, instead of writing a text or a link in this email, as I do below, I would like to make it call an html page, so that when the receiver opens the email it will bring and show that page which is hosted in the same server.
Could anyone help me telling me what to alter in this send routine to accomplish this?
Thanks.
Mario./
__________________________
__________
__________
__________
____
# Output the mail header
print MAIL "To: $TO\r\n";
print MAIL "From: $from_name\r\n";
print MAIL "Reply-To: $from_name\r\n";
print MAIL "Subject: $SUBJECT\r\n\n";
# Output the mail message header with the Local Date/Time and some greetings
if ($INCLUDE_HEADER eq "Yes") {
print MAIL "_________________________
__________
__________
__________
_\n\n";
print MAIL "Este email foi enviado a você por: \n";
print MAIL "$CONFIG{'NOME'} em $date\n";
print MAIL "_________________________
__________
__________
__________
_\n\n";
print MAIL "Ola,\n\nEsse é um convite de \"$CONFIG{'NOME'}\" para você assistir algumas excelentes palestras a respeito de assuntos espirituais. Os temas são atuais, tem a ver com o seu dia a dia em casa, na rua, no trabalho, na faculdade, no lazer. E levam você a ter esperança de uma vida melhor e eterna.\n\n";
print MAIL "Veja o anúncio completo das mesmas, clicando abaixo (pode clicar, nao é virus):\n\n";
print MAIL "
http:\/\/www.advir.org.br\/ped\/ped.html.\n";
print MAIL "_________________________
__________
__________
__________
_\n\n";
}
# Output the mail body
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9]
)/pack("C"
, hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9]
)/pack("C"
, hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
if (($value ne "") &&
($name ne "DESTINO") &&
($name ne "HEADER") &&
($name ne "CONFIRMACAO") &&
($name ne "NOME") &&
($name ne "EMAIL") &&
($name ne "x") &&
($name ne "y"))
{
print MAIL "$name ($CONFIG{'NOME'}):\n\n";
print MAIL "$value\n\n";
}
}
##
}
# Close the pipe and send the mail
close(MAIL);
Start Free Trial