MIME Type detection for Net::SMTP

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting MIME Type detection for Net::SMTP
# 1  
Old 09-01-2011
MIME Type detection for Net::SMTP

I've spent a good two weeks on trying to figure out a proper way to get the mime type of a file. The "file" command on the Sparc machine I'm working on is an older version and does not support the --mime flag. It outputs things like:

somefile.pdf: Adobe Portable Document Format (PDF) v1.5

I was wondering if there was some alternative built in way to detect the mime type. I'm not allowed to use anything other than the default install of ActivePerl. I'm thinking that I'll have to create my own configuration file, but who knows.

My reason for wanting this is because I'm making my own mailer using Net::SMTP. I'm still not even sure how to set my attachments to be transferred as binary or text (or if it really matters). I know that I have to set my

Any an all responses/direction would be greatly appreciated.

Thanks in advance.
# 2  
Old 09-01-2011
Just a suggestion: would it be easier if you just compiled the file utility from source and get it on your system? you can have it compiled to an alternate location so that it does not overwrite your OS supplied file utility.

The below url gives the location of the source.

The Fine Free File Command
# 3  
Old 09-01-2011
Unfortunately, my job wouldn't allow that. Sorry, but thanks for your reply. If I had my way, I'd just use MIME::Lite and be done with it.

---------- Post updated at 12:57 PM ---------- Previous update was at 11:13 AM ----------

Well, since I have this thread open, does anyone know exactly what to set if I need to transfer a binary attachment (using Net::SMTP)?
# 4  
Old 09-01-2011
Maybe you can find whatever database of file-types it uses, and use it to write up a list of mime-types to make conversion simpler.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

MIME type for sending gzip file as attachment in email

Hello, I am trying to send a gzip file on email using below command but the zipped file received on email is corrupt. mailsend -smtp $smtpip -content-type 'application/x-gzip' -mime-type "application/x-gzip" -t $receiver -f $sender -sub "$subject" -M "$MSG" -attach $file file name is ... (1 Reply)
Discussion started by: tushar.modgil
1 Replies

2. Programming

Parallel Processing Detection and Program Return Value Detection

Hey, for the purpose of a research project I need to know if a specific type of parallel processing is being utilized by any user-run programs. Is there a way to detect whether a program either returns a value to another program at the end of execution, or just utilizes any form of parallel... (4 Replies)
Discussion started by: azar.zorn
4 Replies

3. Shell Programming and Scripting

Net::SMTP via PERL is not working in few cases

We are getting some special scenarios where Net::SMTP is not working for some mails. we are sending a similar kind of data via mails but some of the mails are not received. After checking the Net::SMTP in debug mode we found below difference: Good One - (Mail sent properlly) --- -----... (0 Replies)
Discussion started by: NIMISH AGARWAL
0 Replies

4. Shell Programming and Scripting

Sending Attachment using MIME::Lite and Net::SMTP

Hello, I'm a newbie perl scriptor and i'm trying to figure out why i can't send an email using MIME::Lite with Net::SMTP. I keep receiving the following error: SMTP MAIL command failed: 5.7.1 Helo invalid . at attach1.pl line 31 The error keeps coming from the very last line... (2 Replies)
Discussion started by: xmaverick
2 Replies

5. Shell Programming and Scripting

Retrieving File's Mime-type

Alright, so I am trying to use perl (or any other shell scripting language, awk/sed/bash for instance), to retrieve the mime-type of a file. I want to keep it in one file, and most of the modules that are on cpan that check for mime types (Magic), aren't installed on these boxes. Anyone have... (2 Replies)
Discussion started by: Rhije
2 Replies

6. UNIX for Dummies Questions & Answers

Lynx - Downloading - extension handling - changing mime type?

Using Lynx, when I try to download a .rar, it confirms I want to download and its got it as an appication/rar file. However, split archives that end in .r## (.r00, .r01 ...) are not recognized as an appication/rar file and it reads the file like a .txt or .html. How can I fix this? Thanks! (2 Replies)
Discussion started by: yitzle
2 Replies

7. Shell Programming and Scripting

Net::smtp - Did this work

Hi, I have read the related posts by perleo and those who assisted. I wish to do a similar thing, in that I wish to use the Net:smtp module. I have downloaded it and followed the instructions for the install. When I check the perldoc net::smtp, the information returns (thus showing it... (1 Reply)
Discussion started by: cheng
1 Replies

8. UNIX for Advanced & Expert Users

How to Set Mime type to mailx

I have a problem while sending attachement , it is displying Content into body of mail (Junk Data) instead of attachment (zip format) in Linux, same code is working in Sun Solaris.. I have read query in this site , need to set MIME type to mailx componment. Please help me how to set MIME type..... (1 Reply)
Discussion started by: suneel
1 Replies
Login or Register to Ask a Question