Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Mail a file to Email Addressee via Telnet

Posted on 1998-03-06
15
Medium Priority
?
276 Views
Last Modified: 2010-04-21
I have a large file in my ISP server, can I send this file to my friend as a email via Telnet?
So that I don't need to download the large file to my local machine and save time.

I am beginner in unix, would you show me how to do this?
0
Comment
Question by:st
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 2
15 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 2008950
mail friend@ISP.com < largefile
0
 
LVL 1

Author Comment

by:st
ID: 2008951
Can I make the large file as a attachment in the email?
Because it is a binary file. Thanks.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2008952
uuencode filename < filename | mail friend@ISP.com

There may be other ways to do it, depending on your mail program and what's available on your unix system.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:st
ID: 2008953
Great! But how can I specify my name,To (Can it do more than one addreesee), Suject, etc? Thanks.
0
 
LVL 4

Expert Comment

by:jlms
ID: 2008954
Yes, you can, check the man page of the mail program (type: man mail), you will see all the options available.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2008955
Since I'm not sure what mail program you're using, I'll answer in terms of /usr/lib/sendmail, which should exist on your system:

(echo 'Subject: Mail a file to Email Addressee'; echo ''; uuencode filename < filename ) | /usr/lib/sendmail friend@ISP.com st@ISP.com
0
 
LVL 4

Expert Comment

by:jlms
ID: 2008956
usually e-mail programs in UNIX have line options, lets say in an hypotetic example that I write something like:
mail -S"This is the subject" -C"This is a carbon copy" -T"abc@xxx.com" etc, etc. This could be easier, clearer and documented in only one man page. Notice this is just an example, you have to find out the exact option for your program.
0
 
LVL 1

Author Comment

by:st
ID: 2008957
ozo, your answer is quit good that I can send to more that one person, but the addressee can't not found the "To:","CC:" in the message. Moreover, how can I change "From:" instead of the email address of current ISP and how can I include my comment in the message?

I can raise some points for answering these if you need. Thanks.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2008958
Again, it might be easier to answer, (and easier to do) knowing which mail program you're using.
Many of them support command line options, or Graphical User Interfaces, or have encode/decode features for file attachments, etc,
but not all mail programs exist on all systems, and many have different features and different ways of invoking them so it's hard to give a more specific answer.

You can still do all that with /usr/lib/sendmail, but it wasn't intended as a user-interface routine, other programs usually provide that, and then use sendmail to deliver the formated message.
Although you can still do it yourself, as:

(echo 'Subject: Mail a file to Email Addressee'; echo 'CC: abc@xxx.com'; echo 'From: st@experts-exchange.com'; echo ''; echo 'my comments'; uuencode filename < filename ) |
     /usr/lib/sendmail friend@ISP.com st@ISP.com

or

(cat <<END;  uuencode filename < filename ) | /usr/lib/sendmail friend@ISP.com st@ISP.com
Subject: Mail a file to Email Addressee
CC: abc@xxx.com
From: st@experts-exchange.com

my comment in the message
END

0
 
LVL 1

Author Comment

by:st
ID: 2008959
ozo, I tried the second approach and got this message "Can't << within ()'s."
The first aproach can be success in my mail system, but even I specified the email address in the "TO :" or "CC: ", the addressee can't received my mail, only the email addresses specified in the last of the command line can received the mail.

Moreover, when I specified the "TO : superman", the mail will being "TO : superman@my_isp.com".

Are these normal in my unix system? Can I change them? Thanks.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2008960
Not only are there different mail programs with different, but different shells with different syntax too.
I thought I tested (cat <<END; ...) in both sh and csh, but it looks like I only checked it in sh, sorry.

In mail messages, there's a distinction between the "envelope", used by the delivery agent,
the "headers" used by the mail readers, and the "body", the actual text of the message.
You can use the -t switch
sendmail -t
to tell sendmail to gather recipient addresses from the headers in addition to the command line.
(normally your mail program would take care of all of these details for you, and you wouldn't have to worry about it)

Doing things with just the command line is handy for quick little commands, but it can get increasingly unweildy for longer more complicated things.
Do you have a file editor on your system you can use?  Maybe emacs or vi or some other?

If not we can still always use cat:
cat >mail.header
To: superman
Cc: abc@xxx.com
From: st

my comments in the body of the message after a blank line
terminated with a control-D (assuming you haven't redefined youe EOF character)
^D

(cat mail.header;  uuencode filename < filename ) | /usr/lib/sendmail -t friend@ISP.com superman@krypton.dccomics.com

(If you don't specify the site for a user, it usually assumes user@mysite)
0
 
LVL 1

Author Comment

by:st
ID: 2008961
ozo, thank you very much for your answer. How can give the "points" to you?
0
 
LVL 84

Accepted Solution

by:
ozo earned 200 total points
ID: 2008962
If you're happy with the answer, you can grade it.
Otherwise, you can reopen the question and see if you can get a better answer.
(like if you want to know about using any particular mail program)
0
 
LVL 84

Expert Comment

by:ozo
ID: 2008963
I interpreted your last comment to mean that you were happy with the information you've recieved.
If I misunderstood, please Reopen the question, and add a comment to tell us how else we may help you.
0
 
LVL 1

Author Comment

by:st
ID: 2008964
Your posting is very helpful! Thanks.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question