Monday, February 22, 2010

Send Mail via remote SMTP Server on Ubuntu

Sometimes we need to send out mail from linux but do not want to setup a mail server on it. Below is a simple way to implement this function with a existing smtp server.
 
a. install package nail with below command
   apt-get install nail
   or you can search the nail package in http://packages.ubuntu.com
 
b. edit /etc/nail.rc and add below lines in the end of the file
    set smtp=the_existing_smtp_server
 
c. use below command to send out mail
    nail -s your_subject -a your_attachment to_add1 to_add2  < msg_content_file

No comments: