Monday 9 June 2014

email-using-linux-alias


Linux Command And Example

How to send email using aliases from Linux ?

  • On Linux system aliases are available under /etc/aliases file
  • Open file using sudo vi /etc/aliases
  • File format is look like as follow.
    Name1: Value1
    Name2: Value2
    Name3: Value3
  • Now add your alias name and file which has list of email ids as follow
    • <aliasName>: :include:<fileName>
      eg.alertGroup: :include:/home/alpesh/emails.txt
      emails.txt file will have following content
      alpesh@yahoo.com
      alpesh1@yahoo.com
      alpesh2@yahoo.com
      ...
  • Now to test this just type the following command
    echo "Hello This is body text" | mutt -s "Send email using alias" alertGroup@localhost
    Note: for sending email you must have installed a mutt client.