понедельник, 27 октября 2014 г.

Mailx - send email from Ubuntu terminal


I believe mailx is what you're looking for.
sudo apt-get install bsd-mailx 
This will also install postfix at a minimum, and will give you a few options to set postfix up. If you have an SMTP server on your LAN, choose 'satellite system', then enter the mail domain name, and lastly the IP address of your SMTP server.
To use:
echo $MESSAGE_BODY | /bin/mail -s "$SUBJECT" "$RECIPIENT_ADDRESS"
You can also use a file for the body:
/bin/mail -s "$SUBJECT" "$RECIPIENT_ADDRESS" < /tmp/message.txt
share|improve this answer
  
It says missing postfix/main.cf file , how can i download that file –  John Apr 27 '10 at 6:15
  
When you installed mailx it should have run through the install screens for postfix.  Did it ask you which type of install, and for the mail name and relay host?  And when does it give you the error, when you run /bin/mail or when you tried to install? –  nedm Apr 27 '10 at 6:21
  
it didn't ask me anything, how can uninstall it and do that again –  John Apr 27 '10 at 6:28
  
If you have postfix set up as part of another install it sounds like it may not be configured correctly.  Try      "sudo dpkg-reconfigure postfix"  and then     "sudo /etc/init.d/postfix reload"                 –                      nedm                 Apr 27 '10 at 6:28                                                                                                  
  
If postfix isn't installed, then "sudo apt-get remove mailx" and then "sudo apt-get install mailx" and it should install postfix with the mailx package. –  nedm Apr 27 '10 at 6:31


http://serverfault.com/questions/136106/what-package-to-install-for-sending-emails-from-localhost-ubuntu

Комментариев нет:

Отправить комментарий