Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: mail script with attachment

by atcroft (Monsignor)
on Jan 16, 2012 at 23:52 UTC ( #948229=note: print w/replies, xml ) Need Help??

in reply to mail script with attachment

The problem that appears to be occurring is that you are Base64 encoding the file name, rather than the content of the file. This is illustrated by decoding the value that appeared in the email:

$ perl -MMIME::Base64 -le 'print decode_base64(q{MTAwMWR1LnR4dA==});' 1001du.txt

MIME::Base64's documentation does not indicate that it can open a file on its own, but instead encodes the stream of bytes it is given as its first argument.

Hope that helps.

Replies are listed 'Best First'.
Re^2: mail script with attachment
by zlinkexchange (Initiate) on Jan 17, 2012 at 00:44 UTC
    This is what I get when using the $line variable and not the $file variable. I merely switched the two:
    Content-Transfer-Encoding: binary Content-Type: multipart/mixed; boundary="boundary-111916012012" MIME-Version: 1.0 Date: 111916012012 From: To: Subject: New loan request in database (extra fields) This is a multi-part message in MIME format. --boundary-111916012012 Content-Disposition: inline Content-Length: 271 Content-Transfer-Encoding: binary Content-Type: text/plain Dear Member, Please find attached to this email message a loan application file from a recent loan applicant. Be sure to save this DU 3.2 file to you +r hard drive and import the data into your loan processing program. Regards, Site Administration --boundary-111916012012 Content-Disposition: inline; filename="1033du.txt" Content-Transfer-Encoding: base64 Content-Type: application/zip; name="1033du.txt" MTAzM3x8fFNjb3R8c2tpbmdAbW9ydGdhZ2UtcHJvcy5jb218WWVzfFl8fHx8fDF8fDM2MH +x8fHx8 fHx8fHx8fHx8fHx8fHx8fHx8fHxTY290fEN8S2luZ3x8fHx8fGFzZGZ8NTY1NDY1NDY1NH +x8fDE2 NTQxMTIzfDV8fHx8fHx8fHx8fHx8MTIzIEFueSBTdHJlZXR8fEFueSBDaXR5fENBfDEyMz +Q1fHx8 fFl8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8Z3x8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fH +x8fHx8 fHx8fHNhZGZ8fHx8fHx8fHx8fDU2NDU2NTU1fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fH +x8fHx8 fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fH +x8fHx8 fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fH +x8fHx8 fHx8fHx8fHx8fHx8fHxZfFl8fHx8fHx8fHx8fHx8fHx8fHx8fHx8YXBwfHx8U3VibWl0IE +FwcGxp Y2F0aW9ufHw= --boundary-111916012012--

      But, where is $line defined?

      See $/ to slurp the file in a variable

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948229]
and God said, "Let Newton be!"...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2017-05-25 18:56 GMT
Find Nodes?
    Voting Booth?