Sending Email via a Shell

From SHellium Wiki
Jump to: navigation, search
Geographylogo.png In other languages: English | Afrikaans | Albanian | Arabic | Brazilian | Bulgarian | Catalan | Chinese | Croatian | Czech | Danish | Dutch | Esperanto | Estonian | Filipino | Finnish | Flemish | French | German | Greek | Hebrew | Hindi | Hungarian | Indonesian | Italian | Japanese | Latvian | Lithuanian | Macedonian | Malay | Malayalam | Norwegian (Bokmål) | Norwegian (Nynorsk) | Persian | Polish | Portuguese | Romanian | Russian | Serbian | Slovak | Slovenian | Spanish | Swedish | Turkish | Ukrainian | Urdu

Contents

Mutt

Mutt is one of many text based email clients that are available on SHellium. Below is a sample configuration file that users may download to their home directory to get mutt up and running quickly. It is noted Mutt is already installed on the shell, and you can check this by running "ls /bin/usr/mutt*". Or you may simply run the program by typing "mutt" at the command prompt.


Configuring mutt

  • Copy this file into your home directory and rename it to ".muttrc"
cd $HOME; wget http://shellium.org/~bryan/muttrc  (no longer valid)
  • Rename the file to .muttrc and create a .signature file for your outgoing mail signature and an .mailcap file
mv muttrc .muttrc && touch .signature .mailcap

You do not need to edit the file if you don't have any previous experience with mutt. Just create the files and edit the .signature file to add a signature to your outgoing mail and you are finished.

Using mutt

  1. Type 'mutt' at the command prompt and you'll see a menu at the top indicating basic commands to use.
  2. To send mail type 'm'
  3. Enter the to: address ex yourfriend@shellium.org (Hit enter key )
  4. Enter the subject (Hit enter key )
  5. Press "ESCAPE+I" to enter the insert mode. Its similar to vi.
  6. Then type your message, once done press "ESCAPE"
  7. Cursor moves to the bottom of the page with ":" in front of it.
  8. Type "wq!" and the message is saved and written.
  9. You're taken to a new screen; press "y" to send.
  10. It shows you a message that mail has been sent.

Using Mail command

This is how to send mail via the mail command. Perhaps a shell script can use this command some automated email

  1. First type mail email_address_you_want_to_send_the_mail_to (hit enter)
  2. Subject will appear , type your subject (see example below). Then hit enter.
  3. On the next line enter the body of the message.
  4. On a new line put a single DOT (.) and hit enter
  5. Enter whom you want to cc the mail to and hit enter.
  6. The message is sent.

An example is below

08:13:16 keeganpatrao:~$ mail keeganpatrao@shellium.org 

Subject: hi 

Hello Keegan this is a test message

.

CC:

Sample Configuration

Below is a copy of the sample .muttrc that we have provided in the link above

# .muttrc

set folder=~/Maildir
set arrow_cursor
set attribution="%d, %n wrote:"
set copy=yes
set edit_headers
set editor="vim"
set folder_format="%t%N %-30.30f %8s"
set index_format="%4C %Z %{%b %d} %-31.31F %N (%4c) %s"
set mailcap_path="~/.mailcap"
set menu_scroll
	
# set mail_check=5

set mbox=+mbox	
set mime_forward=ask-no
set postponed=+drafts
set print=ask-yes
set print_command=lpr
set record=+sent
set signature="~/.signature"

# set show_alt

set pager_stop
set send_charset="us-ascii:iso-8859-1:koi8-r:windows-1251:utf-8"
set sort=threads
set sort_aux=reverse-date-received
set sort_browser=reverse-date
set spoolfile='~/Maildir'
set from="$USER <$USER@shellium.org>"

Forwarding

Forwarding your e-mail to another address is accomplished with a .forward file in your home directory. The syntax is:

some@email.address.com, another@email.address.com, and@another.email.com

If you would like to keep a copy of the mail on your shell's email account, put in your username prefixed with a backslash:

\username, email@forwarded.com
Personal tools
Namespaces

Variants
Actions
Navigation
Indexes
SHellium Sites
Toolbox