I thought HMMM... I really should test this before I sent it.
I have a really old version of mail.
I tested this on RedHat 6.1, 5.2, Slackware 3.6, 4.0, 7.0.
My BSD and Solaris accounts have outgoing mail blocked sorry.
Anyway, the single line may not work on your system.
But the second version will if you name a current mail
recepient on your server.
mail -s "Logon Notification" awerg@creativepage.com < messagefile.txt
-- Andy
At 11/29/99 8:23:00 PM, you wrote:
>Here is another idea for your email question.
>
>in my .bash_profile I send my self email whn I logon
>(that way I know if someone is using my account)
>
>here is the line.
><code>
>
># email self logon
>mail -s "Logon Notification" awerg@creativepage.com "You've logged on."
>
></code>
>
>description:
>=============
>mail -s (send)
>"Logon Notification" (subject)
>awerg@creativepage.com (address sent to)
>"You've logged on." (message body)
>
>*note: you can also send the body from a text file
>ex: mail -s "Logon Notification" awerg@creativepage.com < messagefile.txt
>
>The system sends the date/time stamp. You can use procmail
>to filter these messages into a folder or whatever.
>You can extend this idea to any bash/perl/python/ash/zsh/... script.
>
>Hope this helps,
>
>-- Andy
>
>
>
>At 11/29/99 1:04:00 PM, you wrote:
>>
>>On Mon, 29 Nov 1999, Webb Sprague wrote:
>>
>>> Does anyone know how to use "mail" in batch mode? I
>>> want to put a line in a shell script that sends me
>>> mail whenever it detects something in my system, like
>>> a security risk. I would also be interested in using
>>> perl so that I could use variables for the various
>>> parts of the header and the text. No, I don't want to
>>> send spam, either...
>>>
>>> I would also like to know how to set up an
>>> auto-response thing, if possible, but that is a ways
>>> off in my development...
>>>
>>> Thanks
>>> W
>>> __________________________________________________
>>> Do You Yahoo!?
>>> Thousands of Stores. Millions of Products. All in one place.
>>> Yahoo! Shopping: http://shopping.yahoo.com
>>> ****************************************************************************
>>> * To UNSUBSCRIBE from the list, send a message with "unsubscribe lug-nuts"
>>> * in the message body to majordomo@saclug.org. Please direct other
>>> * questions, comments, or problems to lug-nuts-owner@saclug.org.
>>>
>>
>>Just do a pipe open to sendmail -t from a perl script. Most of the
>>formmail web scripts do this. You can have your whole message in a
>>variable if you want.
>>
>>
>>Mike Machado
>>mike@innercite.com
>>InnerCite
>>Network Specialist
>>
>>****************************************************************************
>>* To UNSUBSCRIBE from the list, send a message with "unsubscribe lug-nuts"
>>* in the message body to majordomo@saclug.org. Please direct other
>>* questions, comments, or problems to lug-nuts-owner@saclug.org.
>>
>>
>>
>
>****************************************************************************
>* To UNSUBSCRIBE from the list, send a message with "unsubscribe lug-nuts"
>* in the message body to majordomo@saclug.org. Please direct other
>* questions, comments, or problems to lug-nuts-owner@saclug.org.
>
>
>
****************************************************************************
* To UNSUBSCRIBE from the list, send a message with "unsubscribe lug-nuts"
* in the message body to majordomo@saclug.org. Please direct other
* questions, comments, or problems to lug-nuts-owner@saclug.org.
This archive was generated by hypermail 2b29 : Fri Feb 25 2000 - 14:29:08 PST