Archive for September, 2008

SpamAssassin sample procmailrc

Posted: September 29, 2008 in SENDMAIL, SMTP
# SpamAssassin sample procmailrc
# ==============================

# The following line is only used if you use a system-wide /etc/procmailrc.
# See procmailrc(5) for infos on what it exactly does, the short version:
#  * It ensures that the correct user is passed to spamd if spamc is used
#  * The folders the mail is filed to later on is owned by the user, not
#    root.
DROPPRIVS=yes

# Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'
# if you use the spamc/spamd combination)
#
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
#
# The lock file ensures that only 1 spamassassin invocation happens
# at 1 time, to keep the load down.
#
:0fw: spamassassin.lock
* < 256000
| spamassassin

# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
almost-certainly-spam

# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "probably-spam".
:0:
* ^X-Spam-Status: Yes
probably-spam

# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped.  This will re-add it.
# NOTE: This is probably NOT needed in recent versions of procmail
:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "

  :0 fhw
  | sed -e '1s/^/F/'
}
Advertisements

Forwarding all incoming mails

Posted: September 23, 2008 in SENDMAIL, SMTP
Tags:

Forwarding all incoming mails

Typical situation: So far you have used address A. Now you have a new address (B) or are using another address (B) temporarily and you want all mails received at A to be forwarded to address B.

Question:
How do I forward all mails from A to B?

Answer:
Create the file “$HOME/.forward” with only the address B in it. (The program which receives the mail hopefully knows the system of forwarding by the “forward file”.) The permissions of the “forward” must be “600”. [Could be OS specific, but nevertheless is a good idea.]

Example:
Let us assume the following values for the two addresses A and B:

	address A := "guckes@inf.fu-berlin.de"
	address B := "guckes@math.fu-berlin.de"

Now create the “forward file” on a host on the domain “inf.fu-berlin.de”:

	echo "guckes@math.fu-berlin.de" > $HOME/.forward

That’s it!

Caveat:
Make sure that you do not create “loops”, ie creating a “forward file” on both system, sending all the mail from the one system to the other.

 


 

 

Forwarding to more than one address

Keeping a local copy

Assume you receive mail at address A. You forward all mails to address B but you want a copy of *all* mails sent to address C. Then put “\C, B” into your “forward file”. The backslash (“\”) before address C will tell the MTA to send a copy to C. And the “B” tells the MTA to forward the mail to address B.

Example:

	$ cat $HOME/.forward
	\guckes@zedat.fu-berlin.de,guckes@inf.fu-berlin.de

With this you can also leave a copy of your mail in the local mailbox by specifying your local userid:

Example:
	$ cat $HOME/.forward
	\guckes,guckes@inf.fu-berlin.de

If you want to change the received mail before forwarding it then you must use a “filter” program.
[950609,950927,951023]

 


 

 

Forwarding one mail

Forwarding a single mail is as easy as using the command “forward” (“f”) from the Folder Menu. You then have to answer the following prompts: (1) edit (prompt for confirmation), (2) send (prompt for addresses), (3) subject (prompt for new/changed subject).

Prompt#1: To edit ot not to edit – that is the question: [*]

Command: Forward                              Edit outgoing message? (y/n) y

You should answer with ‘y’ for two reasons:

Header weeding
The header of the mail is not weeded by default. Please do so to cut down on the message!   

Info for recipients
It is not always obvious why you forwarded the mail. Please add a note saying why you did so. Instruct the reader what to do, eg “please reply to sender” or “please reply to me”. Or just say “for your information” or “just for laughs”. Whatever. Just say *something* about it!   

Prompt#2: Send. “Who shall receive this?”

Send the message to:

Now enter the recipients’ addresses or aliases. If you don’t enter an address then this will abort the command and you will have to start again.

If you want to continue but don’t know the address or alias of the recipient here then just enter something (eg a dot – ‘.’) – you can correct it later via the “h)eaders” menu:

 

Send the message to: .

Prompt#3: Subject: “What’s it all about?”

Subject: Re: previous subject line (fwd)

ELM suggest you use the same Subject line as the forwarded mail had and adds “(fwd)” to notify that this is a forwarded mail. However, you need not accept this – you can and should always improve the information in the Subject line!

After entering the Subject ELM will call the editor:

Invoking editor...

From now on you probably know how to continue.


Forwarding more than one mail

Situation: You are looking at a folder and you want to forward several of the mails.

Short answer:

  • 0) Change to the folder with ELM.
  • 1) Tag the mails to forward.
  • 2) Save the tagged mails to a seperate folder.
  • 3) Send the folder.

Longer answer:

  • 0) Use “c” to change to the folder which contains the mails to forward.
  • 1) Use “t” to tag all the mails to be forwarded.
  • 2) Use “s” to save all tagged mails to a file, eg “foo”.
  • 3) Send the file “foo” to the addressee.

 


TODO: Describe how to “send a folder”. Note: If the file is big then you should compress it first.

 

 

Compression of files is usually done with either “compress” or “gzip”. Compressing means to use a code to represent the data in a smaller form. This also means that every bit of information is used, especially the highest or eigth bit. Characters with the highest bit are not “text” any more and thus you get a problem transferring these with email. Therefore you have to convert the compressed file to a text file before sending it. This is usually done with “uuencode”.

 

Example:  'gzip file | uuencode | elm -s "forwarded mails" addressee'

Note: The receiver of such a file should have the necessary programs to decode the file and to decompress it, too. So you should ask whether the receiver actually has these programs.

Examples for decoding “uuencoded” files and decompressing the result:

gzip:      'uudecode file | gunzip'
compress:  'uudecode file | uncompress'

Note: The program “BinHex” does the same as “uuencode”, only it uses a different code. The idea behind the program is the same, though, ie convert “binary” data to “text” data. “BinHex” is used on Macintoshes.


 

 

Change of Address

“No account is forever!” – so the saying goes. But what if your the account is closed? Then you certainly need a way to have your mail forwarded.

Several situations are possible: (1) Your account survives for a while. Then you can either have tour mail forwarded with the .forward method or even use a filter or “vacation” to announce your new address. (2) Your account will be terminated. In this case you should ask the admins to forward your mail, but this certainly creates more work. (3) You get yourself a “permanent address” to use always.

 


Permanent Email Address

For every problem there is someone on the net to solve it. [That’s what I say. :-] And to solve the “dying account problem” some sites are specializing in being “permanent addresses”. They give you an address and they will keep it for your so that it may be permanent. Sure, it costs money, but the idea of never having to lose a mail and never having to tell people about your new address is nice.

TODO: list of post office boxes. [960217]


Technical Notes

The “forward mechanism” works via the -> MTA. Thus you can read a bit about this in the manual to the used MTA, eg “man sendmail”:

In addition, if there is a .forward file in a recipient's home directory,
sendmail forwards a copy of each message to the list of recipients that
file contains.  Aliasing can be prevented by preceding the address with a
backslash.

Questions

  • Which permissions for the forward file for which system and MTA?

    change-admin-password– changes the administrator password
  •  
      This remote command is used to modify the admin password. Change-admin-password is interactive in that the user is prompted for the old admin password, as well as the new admin password (with confirmation).

      –t ––terse
      Indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well-formatted data for consumption by a script. Default is false.
      –e ––echo
      Setting to true will echo the command line statement on the standard output. Default is false.
      –H ––host
      The machine name where the domain administration server is running. The default value for Platform Edition is 4848. The default value for Standard and Enterprise Edition is 4849..
      –p ––port
      The port number of the domain administration server listening for administration requests. The default port number for Platform Edition is 4848. The default port number for Enterprise Edition is 4849.
      –s ––secure
      If set to true, uses SSL/TLS to communicate with the domain administration server.
      –u ––user
      The authorized domain administration server administrative username.


      Example 1 Using change-admin-password
      asadmin> change-admin-password --user admin Please enter the old admin password> Please enter the new admin password> Please enter the new admin password again> Command change-admin-password executed successfully.

      0
      command executed successfully
      1
      error in executing the command
  • DESCRIPTION

    OPTIONS

    EXAMPLES

    EXIT STATUS

Reset Lost Password in Sun Application Server

Happens to the best of us, less with system admins more with developers. But we are all human, and believe it or not we DO forget and loose passwords at least once every so often. Some time ago I wrote a tutorial on how to reset lost root password in mysql, and here is another similar tutorial on how to reset the lost domain password but this time for Sun Application Server.

Before going any further with this article, please first check “.asadminprefs” file:

cat /home/toly/.asadminprefs
 
AS_ADMIN_USER=admin
AS_ADMIN_PASSWORD=YourSecretPasswordInTextHere!

the admin password could be there

If it is not there, there are two ways to reset it:

  • Reinstall or recreate the affected domain.
  • Create a new dummy domain and copy its security key file over to the real domain to substitute the password.

Below is an explanation for the second approach (in case when “reinstall or recreate affected domain” is not an option):

Given:

 >   Sun App server is installed in                 "/opt/SUNWappserver"
 >   Domain to which the password is lost:   "domain1"

Step 1. Creating a new dummy domain

/opt/SUNWappserver/bin/asadmin create-domain --adminport 7070 --adminuser admin --instanceport 7071 dummy-domain
 
Please enter the admin password>password
Please enter the admin password again>password
Please enter the master password>password
Please enter the master password again>password
 
Domain dummy-domain created.

Step 2. Copy dummy-domain’s “admin-keyfile” to domain1’s “admin-keyfile”

cp /opt/SUNWappserver/domains/dummy-domain/config/admin-keyfile  /opt/SUNWappserver/domains/domain1/config/admin-keyfile

now the password for domain1 is “password” – DONE )

Step 3. Deleting the dummy domain

/opt/SUNWappserver/bin/asadmin delete-domain dummy-domain
Domain dummy-domain deleted.

NOTES:

The above is true for Sun’s Application Server 8.x and later.

Who does not have a flash memory USB drive? (128Mb – 16Gb…) Everybody does, even my dog, if I had one, would have it. However, sometimes these little dongles can be tricky to use if they are not properly formatted. The usual format for the flash memory USB drive is FAT16, and it is understood by many operating systems with no problem. But in case the drive is not formatted properly/or you think it is not formatted properly, you can always reformat it, and here is how.

The whole process consists of 5 steps ans takes about 15 seconds um.. if do it slowly.. )

WARNING: All the data will be lost from the flash UBS drive since we are going to reformat it.

We are going to use fdisk utility, so “for starters” here are available commands that you can use with fdisk:

a – toggle a bootable flag
b – edit bsd disklabel
c – toggle the dos compatibility flag
d – delete a partition
l – list known partition types
m – print this menu
n – add a new partition
o – create a new empty DOS partition table
p – print the partition table
q – quit without saving changes
s – create a new empty Sun disklabel
t – change a partition’s system id
u – change display/entry units
v – verify the partition table
w – write table to disk and exit
x – extra functionality (experts only)

Now let’s get to cooking a new and fresh flash memory USB drive…

Step 1. Run fdisk via sudo on your USB flash drive device:

user@host:~$ sudo fdisk /dev/sdb

enter “p” command to list current partition table of the USB drive:

Command (m for help): p
 
Disk /dev/sdb: 1039 MB, 1039663104 bytes
32 heads, 62 sectors/track, 1023 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes
Disk identifier: 0xf1f494df
 
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1023     1014785   83  Linux

Here you will see whatever partition (if any) currently present. In my case (above) it is a “Linux” partition, in your case it may be something different. But it does not really matter, because we are going to delete it anyway:

Step 2. Enter “d” command to delete existing partition (if you have any). If you have several, delete several by using”d” command multiple times:

Command (m for help): d
Selected partition 1

Step 3. Now let’s get to business and enter “n” command to create a new partition:

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1023, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1023, default 1023):
Using default value 1023

As you can see from above, I entered “1” for “Partition number”, and hit enter key twice to leave everything by default.

Now let us list current partitions with “p” command again:

Command (m for help): p
 
Disk /dev/sdb: 1039 MB, 1039663104 bytes
32 heads, 62 sectors/track, 1023 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes
Disk identifier: 0xf1f494df
 
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1023     1014785   83  Linux

We have a single “Linux” partition which is fine (for now).

Step 4. Time to actually apply our changes, so enter a “w” command that will write out all the changes to the USB drive.

Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.

fdisk will write all the changes to the USB drive and exit. But we are not done yet. Our goal is to make a (in this case) FAT16 partition, so this USB drive can be read by most operating systems.

Step 5. For that we will use mkfs.vfat utility:

user@host:~$ sudo mkfs.vfat -F 16 /dev/sdb1
mkfs.vfat 2.11 (12 Mar 2005)

Now we are good to go! It was easy, as I promised )

Let’s look at the new USB drive now. Mounting it first:

user@host:~$ sudo mount /dev/sdb1 /mnt/flashka/
user@host:~$ cd /mnt/flashka/
user@host:/mnt/flashka$ ls -l
total 0

Checking what it has under the hood:

user@host:/mnt/flashka$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1             991M     0  991M   0% /mnt/flashka
 
user@host:/mnt/flashka$

It has 991Mb which is what they call 1Gb flash memory USB drive! )

Article from: http://blog.dotkam.com/2008/07/10/restoreformat-usb-flash-drive/

Introduction

ClamAV is a popular tool which scans e-mail for Windows-based viruses1. It can work in several manners, such as the traditional Unix way of accepting the data through stdin and sending reports out through stdout, stderr and/or an appropriate exit code, or it can be used as a sendmail milter.

The principle of a sendmail milter is simple. As the mail is coming down the pipe from the remote host, sendmail feeds it through the milter and then waits for the milter’s reaction. If the reaction is “all is well” then processing carries on as usual. If, on the other hand, the result of the milter operation is “I didn’t like this!” then the mail is rejected right there and then.

The aim of this becomes apparent in the current climate of ‘Net abuse in which the number of junk e-mails and virus infections2 outweighs the amount of genuine e-mail by far, and in which viruses routinely forge the From: address from which they claim to be sent. If we were to accept the mail, discover that it was infected after having accepted it, and then strive to comply with the relevant RFC which states that the sender must be informed in the event of mail not being delivered to the final recipient, we’d be bouncing mail back to innocent bystanders whose only mistake (admittedly a big mistake given the abysmal security track record of the most widespread operating system for desktop PCs) was to have their e-mail address in a friend’s address book or in the clear on a web page.

Note that bouncing the original mail back on the one hand, and sending a thoughtful message saying “Your message to XYZ was not delivered because it contained virus ABC” on the other are both equally abusive!

There is only one way we can reject an infected mail outright without generating an abusive bounce, and that is to reject the mail during the SMTP session in just the same way you’d reject spam from a blacklisted IP address or domain. This is precisely the purpose of using ClamAV as a sendmail milter.

I’ll be assuming that you’re not a total newbie in this document. It is assumed that you’re familiar with compiling software and playing with configuration files, above all sendmail’s configuration files.

Step 1 – Compiling sendmail

If you’re using a binary distribution of sendmail prepared by a Linux distribution supplier such as Debian, Mandrake, SuSE or Red Hat/Fedora, the chances are that your binary has been compiled with milter support and you can skip this part and move straight on to step 2. As a general rule, if you have a file called libmilter.a in /usr/lib or /usr/local/lib and a directory called libmilter in /usr/include or /usr/local/include, then your version of sendmail has been compiled with libmilter support. If not, read on.

Grab a source tarball from a sendmail.org mirror (see http://www.sendmail.org/mirrors.html for a list of mirrors) and untar the tarball. As of writing this (23/JUL/2004) the latest stable version of sendmail is 8.13.0.

Now set it up so that milter support will be added. Go into the devtools/Site directory under the source root and edit (or create if it doesn’t already exist) site.config.m4 so that it contains these 2 lines:

APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')
APPENDDEF(`conf_libmilter_ENVDEF', `-D_FFR_MILTER_ROOT_UNSAFE ')

Now go back to the source root and build/install sendmail as usual.

Before running sendmail, we’ll need to build libmilter. Go into the libmilter directory under the sendmail source tree root and run:

# sh Build
# make install

The libmilter library and include files are now installed.

Step 2 – Compiling ClamAV

Start by creating the “clamav” user and group as which the milter will run (it’s not a good idea for it to run as root):

# groupadd clamav
# useradd -g clamav clamav

Create the directory /usr/local/share/clamav in which we’ll be instructing ClamAV to put its virus signature database, then give the directory appropriate permissions:

# mkdir /usr/local/share/clamav
# chown clamav:clamav /usr/local/share/clamav

Now grab the ClamAV source from sourceforge.net.

Untar the tarball, build and install ClamAV:

# tar -xzf clamav-0.75.tar.gz
# cd clamav-0.75
# ./configure --disable-clamuko --enable-milter --with-dbdir=/usr/local/share/clamav
# make
# make install

Step 3 – Configuring and starting ClamAV

No particular “–prefix=…” option was given while compiling ClamAV, meaning that its installation prefix is the default /usr/local. ClamAV will therefore expect to find its configuration file in /usr/local/etc/clamav.conf. The sample configuration in the etc directory under the ClamAV source tree root is well commented and should give you plenty of information on what needs changing and what it should be changed to.

Once your clamav.conf file is set up in /usr/local/etc you can start the ClamAV daemon:

# /usr/local/sbin/clamd

It is also recommended that you make sure clamd is started when the machine boots. You can do this by appending the required command to your /etc/rc.d/rc.local file:

# echo "/usr/local/sbin/clamd" >> /etc/rc.d/rc.local

Next, before ClamAV can recognise viruses it needs a signature database. Furthermore, this database must be kept up to date as new varieties of virus are being released every day. ClamAV provides a tool called freshclam for this. This tool also needs a configuration file, /usr/local/etc/freshclam.conf. The sample provided in the ClamAV distribution can also be used as a starting point for your own configuration.

Once that’s set up, we need to grab an initial virus signature database. We’ll be logging the database retrieval in /var/log/clam-update.log, so create the file and above all give it permissions such that freshclam (running as user clamav, group clamav) will have write access to it:

# touch /var/log/clam-update.log
# chown clamav:clamav /var/log/clam-update.log
# chmod 640 /var/log/clam-update.log

Now invoke freshclam and get it to download the latest definitions (this can take some time on a slower connection):

# /usr/local/bin/freshclam -l /var/log/clam-update.log
ClamAV update process started at Sat Jul 24 17:04:12 2004
Reading CVD header (main.cvd): OK
Downloading main.cvd [*]
main.cvd updated (version: 24, sigs: 21793, f-level: 2, builder: tomek)
Reading CVD header (daily.cvd): OK
Downloading daily.cvd [*]
daily.cvd updated (version: 420, sigs: 1062, f-level: 2, builder: tomek)
Database updated (22855 signatures) from database.clamav.net (213.230.200.242).

If you get a warning about there being no support for digital signatures while downloading the virus definition files, it’s because you don’t have the GNU MP arbitrary precision mathematical libraries installed. These are available from http://www.swox.com/gmp/. While they’re not absolutely necessary, they are strongly recommended because they help ClamAV provide greater security and data integrity.

/var/log/clam-update.log should look something like this now:

--------------------------------------
ClamAV update process started at Sat Jul 24 17:04:12 2004
main.cvd updated (version: 24, sigs: 21793, f-level: 2, builder: tomek)
daily.cvd updated (version: 420, sigs: 1062, f-level: 2, builder: tomek)
Database updated (22855 signatures) from database.clamav.net (213.230.200.242).

It will also contain the warning about the lack of support for digital signatures if the GMP libraries are not installed.

This update process should be automated and should happen at least twice a day. As root, run crontab -e and create this cron job:

# Update ClamAV database twice a day
0 2,13 * * * /usr/local/bin/freshclam --quiet -l /var/log/clam-update.log

Now you can test the software to make sure it’s installed correctly. ‘cd’ into the test directory under the ClamAV source tree root. You’ll see several files in there which contain ClamAV test signatures that ClamAV should pick up. Try scanning the ‘test’ file:

# clamdscan test
test: ClamAV-Test-Signature FOUND

----------- SCAN SUMMARY -----------
Infected files: 1
Time: 0.006 sec (0 m 0 s)

If you get something like this:

# clamdscan test
connect(): No such file or directory
ERROR: Can't connect to clamd.

----------- SCAN SUMMARY -----------
Infected files: 0
Time: 0.003 sec (0 m 0 s)

then the chances are that clamd isn’t running. Try launching it and checking that it is indeed running afterwards:

# /usr/local/sbin/clamd
# ps ax | grep clamd | grep -v grep
11752 ?        S      0:00 /usr/local/sbin/clamd

If clamd refuses to start then double-check your /usr/local/etc/clamav.conf file and the permissions on all the objects it references. Remember that clamd runs as user clamav, group clamav.

Step 4 – Tying ClamAV into sendmail

First we need to start the daemon, clamav-milter, which sets up the unix socket that sendmail will use, and which therefore acts as a go-between between sendmail and the clamd analyser:

# /usr/local/sbin/clamav-milter -l -o -q /var/milter/clmilter.sock

`man clamav-milter’ will give full explanations on the options in the above command line. This particular combination scans all inbound and outbound mail (-o) as well as that sent from within the LAN (-l) and suppresses messages to postmaster (-q) each time a virus is detected – I’m getting about 10 a day (which is a lot less than some) so I don’t want to receive notification each and every time.

Also, add the command to your /etc/rc.d/rc.local so that the daemon is started whenever the machine is:

# echo "/usr/local/sbin/clamav-milter -l -o -q /var/milter/clmilter.sock" >> /etc/rc.d/rc.local

The final step is to get sendmail to use the milter. To do so, add the following lines to your /etc/mail/sendmail.mc file:

INPUT_MAIL_FILTER(`clmilter',`S=local:/var/milter/clmilter.sock, F=, T=S:4m;R:4m')dnl
define(`confINPUT_MAIL_FILTERS', `clmilter')

Build a new sendmail.cf and restart sendmail, you’re ready to start blocking viruses.

If you are looking to send email with attachment via shell script or at shell prompt/command line (read as bash prompt), use mutt command.

Mutt is a small but very powerful text based program for reading electronic mail under UNIX /Linux operating systems, including support for color terminals, MIME, and a threaded sorting mode.

Please note that mutt is a pure MUA and cannot send e-mail without proper email server . You need a working Mail Transfer Agent (MTA) such as sendmail or postfix. I am assuming that you have configured email server.

Install mutt

If mutt is not installed, use apt-get or yum or up2date command as follows (login as a root user):

(A) Debian Linux / Ubuntu Linux user use following command to install mutt:
# apt-get install mutt

B) Fedora / CentOS or Red Hat Linux (RHEL) user can use following command to install mutt:
# yum install mutt
OR
# up2date mutt

C) FreeBSD user use following command to install mutt via pkg_add command:
# pkg_add -v -r mutt

How do I send email attachments from a command prompt?

1) Use mutt command as follows to send an email with attachment:
$ mutt -s "Test mail" -a /tmp/file.tar.gz vivek@nixcraft.co.in < /tmp/mailmessage.txt

Where,

  • vivek@nixcraft.co.in – is the recipient
  • /tmp/mailmessage.txt – is the main body of the e-mail (read message from the file “mailmessage.txt”)
  • /tmp/file.tar.gz – is an attachment (with option -a)
  • “Test mail” – is a subject line (option -s)

————————————————————————————————————-

Send mail bash script

Here is what you need to put in a shell script:

#!/bin/bash
# script to send simple email
# email subject
SUBJECT="SET-EMAIL-SUBJECT"
# Email To ?
EMAIL="admin@somewhere.com"
# Email text/message
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "This is an email message test"> $EMAILMESSAGE
echo "This is email text" >>$EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

—————————————————————————————————