Just another Perl shrine | |
PerlMonks |
Limit on attached filename for Mail::Sender?by bulrush (Scribe) |
on Dec 03, 2014 at 15:22 UTC ( [id://1109123]=perlquestion: print w/replies, xml ) | Need Help?? |
bulrush has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use Mail::Sender to send a file, but I have to give Mail::Sender the full path of the file (because the Perl program will be run by cron), which is 90 characters. Is there a limit on the number of characters in the filename to attach? I'm actually using programa.pl to call programb.pl, where programb.pl returns the path of the file to attach in programa. Like this: $output=`perl /somewhat/long/path/here/and/there/programb.pl -option`; After the command call, I simply change $output to an array, then scan for the text 'Filename=/home/blah/perl/foo/file.xls'. Both do 'use Mail::Sender' but programb.pl does not create an instance (like $sender=new Mail::Sender()) because I have an option for programb that does not create an email. I thought programb.pl might be clobbering something in programa.pl. I keep getting this error from Mail::Sender: 'Server error: 500 command unrecognized'. The command send is 'QUIT'. The bottom of the mail log is << --Message-Boundary-by-Mail-Sender-1417619876-- << << . >> 250 P3HY1p00h2AhH0801 mail accepted for delivery << QUIT >> 500 command unrecognized << quitThe section of code I'm using is: if (len($fnout)>0) { if (-e $fnout) # If $fnout exists then send email. { @a=split('/',$fnout); $fn=$a$#a; # Drop directories from $fnout. $resultds=0; # Was $resultds=$senderds->MailFile(...) $s="$procname: Sending email to $to..."; #debugpr($s,$prefixsp); # You can also use cc=>'comma,sep,list' # Also bcc=>'comma,sep,list' $resultds=$senderds->MailFile( { debug=>$logfn, # Debug/log file debug_level=>4, client=>'xxxclient', smtp=>$smtpserver, port=>80, from=>$user, authid=>$user, authpwd=>$pw, auth=>'LOGIN', to=>$to, msg=>$body, subject=>$subjparam, file=>$fnout }); #if (($resultds<0) and ($resultds != -5)) if (($resultds<0) ) { $s=$prefixsp."$procname ERROR: ". "$resultds on MailFile(): '". trim($Mail::Sender::Error)."'\n"; writeerr($s); $senderds->Close(); # Close on error. writeerrfile('all'); exit 1; } } # if -e fnout else { $s=$prefixsp."$procname ERROR: $fnout does not exist."; writeerr($s); $senderds->Close(); writeerrfile('all'); exit 1; } }The mail gets sent but it never has the attachment. I'm trying to get a PAUSE id so I can report this as a bug on CPAN. Thanks!
Back to
Seekers of Perl Wisdom
|
|