Search This Blog

How to send emails from command line on Linux?

  1. Make sure you have set up the Mail Transport Agent, e.g. exim4 or postfix
  2. Install mailutils, which contains commandmail:
    sudo apt-get install mailutils
    
  3. send email using mail command:
    echo "this is a test mail." | mail -s "test" -c john@myorg1.org -b tom@myorg2.org terry@myorg.org 
    
    -b: [BCC] -c: [CC] -s: [subject]

see also

about mail command


No comments:

Post a Comment