wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes Sending File through email Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Sending File through email " Watch "Sending File through email " New topic
Author

Sending File through email

Ajai
Ranch Hand

Joined: May 29, 2002
Posts: 198
Hi,

Can anybody tell me the command to send logs (files) through e mail in UNIX.Assume file is residing in UNIX dir.


Thanks
Rampreet
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

We have a strict policy on display names, which must be a real first and last name with a space between.

Please go here and fix your display name up, pronto. Thanks, pardner!


[Jess in Action][AskingGoodQuestions]
Lewin Chan
Ranch Hand

Joined: Oct 10, 2001
Posts: 214
Well, on Linux that depends on which MTA you have installed. There are quite a few choices I think, sendmail/postfix etc etc. Commonly sendmail is installed for the local user to run from the commandline. Here's an example of using that...

(
echo "To: Me <me@me.com>"
echo "From: You <you@you.com>"
echo "Subject: Here's the file I really wanted to send you"
echo
cat the_file_you_wanted_to_send
)> /usr/lib/sendmail -t

So basically here, you are using cat to print the file you wanted to send to the screen, this is redirected to the sendmail program

The -t option on sendmail is to "read message for recipients" so it parses the To/From/ lines for that info. You don't have to use it in that fashion of course, you can specify all those things on the commandline.


I have no java certifications. This makes me a bad programmer. Ignore my post.
 
 
subject: Sending File through email
 
Similar Threads
Problem in Arrays passing.
Caching Problem in Tomcat
Alert message translations - design question
How run aaplet through ant.
About MVC-II Architecture