Estoy enviando un correo electrónico a través de SMTP en perl. El correo electrónico contiene algunas tablas, enlaces y listas. Estoy usando datos de formato html.
$smtp->data();
$smtp->datasend("MIME-Version: 1.0nContent-Type: text/html; charset=utf-8 nn<H1>");
$smtp->datasend("$message");
...
$smtp->dataend();
$smtp->quit;
A veces el tamaño del correo electrónico es demasiado grande alrededor 1mb
. ¿Hay alguna manera de reducir el tamaño del correo electrónico sin reducir la cantidad de datos? No quiero el mensaje como un archivo adjunto. Yo uso Outlook para abrir los correos.
Respuestas
0 para la respuesta № 1Deberías usar Mail :: Sender para enviar adjuntos a través de correo electrónico
#!/usr/bin/perl
use Mail::Sender
$to = "email1@example1.com,email2@example2.com";
$sender =new Mail::Sender {
smtp => "smtp.mailserver.com",
from => "script@somedomain.com,
});
$subject = "This is a Test Email";
$sender->OpenMultipart({
to => "$to",
subject => "$subject",
});
$sender->Body;
$sender->SendLineEnc("Test line 1");
$sender->SendLineEnc("Test line 2");
$sender->Attach({
description => "Test file",
ctype => "application/x-zip-encoded",
encoding => "Base64",
disposition => "attachment;
filename="File.zip"; type="ZIP archive"",
file => "$file",
});
$sender->Close();
exit();
o utilizando MIME :: Lite
use MIME::Lite;
$msg = MIME::Lite->new (
From => $from_address,
To => $to_address,
Subject => $subject,
Type =>"multipart/mixed"
) or die "$!n";
### Add the ZIP file
$msg->attach (
Type => "application/zip",
Path => $my_file_zip,
Filename => $your_file_zip,
Disposition => "attachment"
) or die "Error adding $file_zip: $!n";
### Send the Message
$msg->send("smtp", $mail_host, Timeout=>60);