OpenWrt Forum Archive

Topic: sendmail on openwrt

The content of this topic has been archived on 8 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I want to implement the sending mail function on my openwrt,that is I need to install
a software which is similar as the Sendmail.But I found there is only a package called
mini_sendmail.It need a smtp server or something else to work,and that's not i want.

it seems  very tough to build Sendmail by oneself.
anyone has experience about this or some idea on this issue?
thanks very much if there is anyone can help.

Hmm, Sendmail or any other full featured MTA is pretty heavy stuff for a router. I think you will be better off with something lighter and relay mail to some smtp server. I pretty much like msmtp.

"you should search before u ask"
I forget it just now

I get ssmtp after searching,and i think it's the very sw i need.

sime wrote:

Hmm, Sendmail or any other full featured MTA is pretty heavy stuff for a router. I think you will be better off with something lighter and relay mail to some smtp server. I pretty much like msmtp.

i'll check it what you recommend .thank u for ur reply . : )

I have Xmail running and made a trick to use sendmail with that, For now am travelling but will update you when I get home, For personal mailboxes in my family it works fine also i have a webmail solution installed so mail can be read when you are traveling.

Rgds. Margate

margate wrote:

I have Xmail running and made a trick to use sendmail with that, For now am travelling but will update you when I get home, For personal mailboxes in my family it works fine also i have a webmail solution installed so mail can be read when you are traveling.

Rgds. Margate

so kind of u
i'll be waiting

Hi giggham

I did this
Installed xmail, it will put executables in /usr/bin and MailRoot in /tmp
I then copied MailRoot to my stick

cd /tmp
cp -rp MailRoot /www/

I created the start script XMail in /etc/init.d/ with the following - you should edit XMAIL_ROOT variable


#!/bin/sh                                                                       
#                                                                               
# skeleton      example file to build /etc/init.d/ scripts.                     
#               This file should be used to construct scripts for               
#/etc/init.d.                                                                   
#                                                                               
#               Written by Miquel van Smoorenburg <miquels@cistron.nl>.         
#               Modified by Davide Libenzi <davidel@xmailserver.org>             
#                                                                               
# Version:      @(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl               
#                                                                               
                                                                                 
XMAIL_ROOT=/www/MailRoot                                                         
XMAIL_CMD_LINE="-SX 1 -Qn 1 -Yt 1 -Ln 1 -PX 1 -CX 1 -Pl -Sl -Ql -Ll -Yl -Yi 600"
DAEMON=/usr/bin/XMail                                   
NAME=XMail                                             
DESC="XMail server"                                     
echo $DAEMON                                           
test -f $DAEMON || exit 0                               
                                                       
set -e                                                 
ulimit -c 10000                                         
                                                       
start_xmail() {                                         
MAIL_ROOT=$XMAIL_ROOT                                 
export MAIL_ROOT                                       
MAIL_CMD_LINE=$XMAIL_CMD_LINE                         
export MAIL_CMD_LINE                                   
$DAEMON                                               
while [ ! -f /var/run/$NAME.pid ]                     
do                                                     
  sleep 1                                               
done                                                   
}                                                       
                                                       
stop_xmail() {                                         
if [ -f /var/run/$NAME.pid ]                           
then                                                   
  echo `date` > $XMAIL_ROOT/.shutdown                   
  kill `cat /var/run/$NAME.pid`                         
  sleep 1                                               
  #while [ -f $XMAIL_ROOT/.shutdown ]                   
  #do                                                   
  # sleep 1                                             
  #done                                                 
fi                                                     
}                                                       
                                                       
                                                       
case "$1" in                                           
start)                                                 
  echo -n "Starting $DESC: "                           
  start_xmail                                           
  echo "$NAME.[" `cat /var/run/$NAME.pid` "]"           
;;                                                     
stop)                                                 
  echo -n "Stopping $DESC: "                           
  stop_xmail                                           
  echo "$NAME."                                         
;;                                                     
restart|force-reload)                                 
  echo -n "Restarting $DESC: "                         
  stop_xmail                                           
  sleep 1                                               
  start_xmail                                           
  echo "$NAME.[" `cat /var/run/$NAME.pid` "]"           
;;                                                     
*)                                                     
  N=/opt/etc/init.d/Xmail                               
  echo "Usage: $N {start|stop|restart|force-reload}" >&2
  exit 1                                               
;;                                                     
esac                                                   
exit 0

create MailRoot/ctrlaccounts.tab
cd <MailRoot directory>
XMCrypt <The password you like for admin account>
vi ctrlaccounts.tab and insert one line with the username<tab>output from above line

start Xmail with /etc/init.d/Xmail start - first time will take some time because Xmail will create a spool structure in MailRoot/spool directory

sendmail there comes with Xmail need MAIL_ROOT variable so i did the following

mv /usr/bin/sendmail /www/MailRoot/bin/sendmail.org

created /www/MailRoot/bin/sendmail.xmail.sh with the following

#!/bin/sh
export DEFAULT_DOMAIN="domain.org"
if [ -z $MAIL_ROOT ]; then
        export MAIL_ROOT=/www/MailRoot
fi
$PWD/sendmail.org $*

chmod +x /www/MailRoot/bin/sendmail.xmail.sh
ln -s /www/MailRoot/sendmail.xmail.sh /usr/bin/sendmail

you should now me able to use sendmail the normal way

eg. sendmail -s xxx@yyy.zzz

enter some text and press ctrl D

I order to configure Xmail with domains and users i advice you to install phpxmail 1.5, find it here http://phpxmail.sourceforge.net/

If you want Webmail i recommend http://www.telaen.org/, but use sendmail when you configure it as smtp access will take a little time if you configure the spam filter,

If you want outlook skin I have this working on OpenWrt
http://tdah.us/index.php?option=com_doc … ;Itemid=27


Rgds Margate

The discussion might have continued from here.