Read file to mail

Introduction to UNIX/Linux (70037) - Jim Griffin
Forum rules
Be nice to each other!
Locked
User avatar
Thaddeous_Arnsdorf
Posts: 10
Joined: Wed Feb 09, 2011 2:38 pm

Read file to mail

Post by Thaddeous_Arnsdorf » Thu May 19, 2011 9:05 am

Hello,

I have a text file of my entire history that i want to email to my self for archiving after this class ends. I forget the command that will read the file into the body of the email.

thanks.

User avatar
Gabriel Vistica
Posts: 213
Joined: Tue Feb 09, 2010 6:06 pm
Location: Sonora, CA

Re: Read file to mail

Post by Gabriel Vistica » Thu May 19, 2011 10:54 am

You can type a question mark into the /bin/mail prompt for a list of the commands.

User avatar
Thaddeous_Arnsdorf
Posts: 10
Joined: Wed Feb 09, 2011 2:38 pm

Re: Read file to mail

Post by Thaddeous_Arnsdorf » Thu May 19, 2011 3:20 pm

thanks.

I went back and reviewed the chapter on redirecting output with pipes.

cat "file name" | mail -s "subject" "email address"

Worked for me. :D

User avatar
Jim Griffin
Site Admin
Posts: 340
Joined: Tue Jan 12, 2010 8:52 pm
Location: Cabrillo College
Contact:

Re: Read file to mail

Post by Jim Griffin » Fri May 20, 2011 8:05 pm

This works too:
mail -s "Subject Line" email_address < filename

User avatar
Thaddeous_Arnsdorf
Posts: 10
Joined: Wed Feb 09, 2011 2:38 pm

Re: Read file to mail

Post by Thaddeous_Arnsdorf » Mon May 23, 2011 6:01 pm

Jim Griffin wrote:This works too:
mail -s "Subject Line" email_address < filename
thanks.

User avatar
Gabriel Vistica
Posts: 213
Joined: Tue Feb 09, 2010 6:06 pm
Location: Sonora, CA

Re: Read file to mail

Post by Gabriel Vistica » Mon May 23, 2011 11:47 pm

Also, ~r <filename> while in the message. This works similar to reading in other messages with ~m.

Locked

Return to “CIS 90 (classroom) - Spring 2011”