Linode Forum
https://forum.linode.com/

[Solved] Email from Command Line
https://forum.linode.com/viewtopic.php?f=11&t=5030
Page 1 of 1

Author:  Michael-Martin [ Sat Jan 09, 2010 11:27 am ]
Post subject:  [Solved] Email from Command Line

I've set up Postfix on my Linode. The majority of emails are sent/received through Google Apps, but Postfix lets me create emails in PHP forms.

When I try to send an email via the command line though, I get

Code:
mail: command not found


I'm not sure how Postfix works, but is there another tool I should be installing to make this work, or is it something I can configure within Postfix?

Here's the script I'm running btw:

Code:
#!/bin/sh
( rkhunter --versioncheck
rkhunter --update
rkhunter --cronjob --report-warnings-only
) | mail -s "Rkhunter Output" michael@problogdesign.com



Really appreciate any ideas on what to try, thanks!

Author:  sleddog [ Sat Jan 09, 2010 11:52 am ]
Post subject: 

Sounds like you don't have the mailx package installed. How you do it depends on your distribution.

e.g., for CentOS:

yum install mailx

Author:  sweh [ Sat Jan 09, 2010 2:18 pm ]
Post subject: 

Or you could called the "sendmail" command (which postfix and most others emulate) directly.

It may be in /usr/lib or /usr/sbin (or both!)

eg
Code:
#!/bin/sh
(
  echo To: michael@problogdesign.com
  echo Subject: Rkhunter Output
  echo
  rkhunter --versioncheck
  rkhunter --update
  rkhunter --cronjob --report-warnings-only
) | /usr/lib/sendmail -t

Author:  Michael-Martin [ Sun Jan 10, 2010 1:36 pm ]
Post subject: 

Sleddog - Ah, you're right, I haven't installed it. I didn't realize it was needed for the mail syntax, thanks! I'll remember that for the future! :)


Sweh - That worked perfectly, thanks so much! Using it now :D

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/