SME 5.x SMTPclient HowTo
Author:  Ruwan Jayasinghe <rjayasin**lausd.k12.ca.us>
Contributor: Darrell May 
Release supported: SME 5.6U4
License: GPL
Last updated: October 1, 2003
RJ
Problem:  You want to use the CLI to send an email using an “external” SMTP server, on your SME 5.x server. (This may be needed if port 25 is blocked by some upstream provider. They want you to use their SMTP.)

Solution:  Follow this Howto (I tried the SME 5.x “SMART_HOST” setting and it didn’t work)

STEP 1: Download and undo this tarball:
 
[root@e-smith root]# mkdir smtpclient
[root@e-smith root]# cd smtpclient
[root@e-smith smtpclient]# wget ftp://ftp.engelschall.com/sw/smtpclient/smtpclient-1.0.0.tar.gz
[root@e-smith smtpclient]# tar –xzvf smtpclient-1.0.0.tar.gz 


STEP 2: Configure, and make:
 
[root@e-smith smtpclient-1.0.0]# ./configure
[root@e-smith smtpclient-1.0.0]# ./config.status
[root@e-smith smtpclient-1.0.0]# make


STEP 3: Copy the binary to /usr/sbin
 
[root@e-smith smtpclient-1.0.0]# cp smtpclient /usr/sbin


STEP 4: Usage
 
[root@e-smith root]# smtpclient -s test -f send-er@domain.xxx -S smtp.domain.xxx   rx-er@anotherdomain.yyy
<type in your message here>
<ctrl-d>

Or 
[root@e-smith root]# cat msg.txt|smtpclient -s test -f send-er@domain.xxx -S smtp..domain.xxx rx-er@somedomain.yyy

For more options 
[root@e-smith root]# smtpclient --help


STEP 5: Notes

1:  If GCC is needed to compile the above, download the following and install.
 
[root@e-smith root]# mkdir devel
[root@e-smith root]# cd devel
[root@e-smith devel]# wget ftp://speakeasy.rpmfind.net/linux/redhat/updates/7.3/en/os/i386/cpp-2.96-113.i386.rpm
[root@e-smith devel]# wget ftp://speakeasy.rpmfind.net/linux/redhat/updates/7.3/en/os/i386/gcc-2.96-113.i386.rpm
[root@e-smith devel]# wget ftp://speakeasy.rpmfind.net/linux/redhat/updates/7.3/en/os/i386/glibc-devel-2.2.5-43.i386.rpm
[root@e-smith devel]# wget ftp://speakeasy.rpmfind.net/linux/redhat/updates/7.3/en/os/i386/glibc-kernheaders-2.4-7.16.i386.rpm
[root@e-smith devel]# rpm -Uhv *.rpm 

2:  The option <-f> requires a valid “from” address.
 
[root@e-smith root]# smtpclient -s test -f txuser@domain.xxx -S smtp.domain.xxx   rxuser@@anotherdomain.yyy

3:  A sample script. Use it to tarball a folder with date/time as the name and email a status message.
 
##Run these commands ONCE, to setup a cron job

root# mkdir -p  /etc/e-smith/templates-custom/etc/crontab
root# echo "00 13 * * mon,tue,wed,thu,fri root /root/backupUF" > /etc/e-smith/templates-custom/etc/crontab/backupUF
root# /sbin/e-smith/expand-template /etc/crontab

##Copy the script below to /root named as backupUF,  edit ADM_EMAIL, SMTP_SVR, EMAIL_SUBJ to suit your app.

#*********************************************************************
#!/bin/bash

ADM_EMAIL=your-email@domain.xxx
SMTP_SVR=smtp.domain.xxx
EMAIL_SUBJ=BU-UserFilesRok
##
TAR_FILE=/root/BU-UserFiles-`date +%H%M%S`-`date -I`.tar
tar -cvf $TAR_FILE /home/e-smith/files/users/;
ls -l /root/*.tar |smtpclient -s $EMAIL_SUBJ -f $ADM_EMAIL -S $SMTP_SVR $ADM_EMAIL;
#*********************************************************************

##Then,

[root@e-smith root]# chmod 755 backupUF

##(I use this in my classroom to backup student workdaily.)