[Cascavel-pm] Erro no envio email com attachment ...
Ednardo Lobo
ednardo em elobo.cjb.net
Sexta Janeiro 31 09:52:26 CST 2003
On Fri, Jan 31, 2003 at 10:40:49AM -0200, Marcia Henke wrote:
> Citrus Punch
>
> Estou tentando mandar um email com attach, mas o seguinte script que
> criei esta dando o seguinte erro : Script é: #################
> #!/usr/bin/perl
>
> use MIME::Lite;
>
> $0 = "System09.log";
> $1 = "mhenke em inf.ufrgs.br";
> $2 = "smtp.inf.ufrgs.br";
> $3 = "Teste de email com attach.\n";
> $4 = "Em anexo arquivo.\n";
> $5 = 'TEXT';
> $6 = "/home/monitor/logs/2003/System09.log";
> $7 = "marcia em suryatec.com.br";
>
> Mail_File ($0, $1, $2, $3, $4, $5, $6, $7);
>
> sub Mail_File {
> my ($fileName, $myMailAddress, $email_address, $title, $body_message, $fileType, $fileName, $o
> utFileName) = @_;
> $fileName = $_[0]; # To attach
> $myMailAddress = $_[1]; # Your email address / address e-mail should appear from
> $email_address = $_[2]; # Recipients mail address
> $title = $_[3]; # Email title
> $body_message = $_[4]; # Text in main part of e-mail
> $fileType = $_[5]; # Know whether attachment is 'BINARY' or 'TEXT'
> $fileName = $_[6]; # Name of file to attach (including path)
> $outFileName = $_[7]; # Name to give e-mail attachment
>
> # Create MIME::Lite mail object
> my $msg = MIME::Lite->new(
> From => $myMailAddress,
> To => $email_address,
> Subject => $title,
> Type => 'multipart/mixed',
> );
> # Main Body of message
> $msg->attach(
> Type => 'TEXT',
> Data => $body_message
> );
>
> # Attach file here
> $msg->attach(Type => $fileType,
> Path => $fileName,
> Filename => $outFileName,
> Disposition => 'attachment'
> );
> # Send e-mail
> $msg->send();
> } # end sub Mail_File
>
> O seguinte erro : ###############
> Modification of a read-only value attempted at ./attach.pl line 6.
>
> Márcia Henke
As variáveis $0, $1, $2, etc., são reservadas e read-only, não
podendo receber valor explícitos como você está fazendo em seu
programa. Elas serão implicitamente alteradas quando uma expressão
regular avaliada possuir os formatadores agrupadores '(' e ')', sendo
inicializadas com o valores agrupados.
--
Ednardo Lobo - www.elobo.cjb.net
Por favor, evitem enviar anexos no formato MS-Office, obrigado!
Veja: http://www.fsf.org/philosophy/no-word-attachments.pt.html
Mais detalhes sobre a lista de discussão Cascavel-pm