An Off-Line Email System
Even if you can read emails online, it is a very good way to waste your money. What can you do to save money?
There are two programs which allow an off-line work at home. The first is sendmail, the second is popclient.
But before we explore sendmail and popclient we have to edit the file /etc/hosts and to insert one entry for the mail server. If you have created i4l.config and called "makeleaf" this is done already. If you did not do it, you must add:
/etc/hosts (cutting) <IP address> <name_of_mail_server> getmail
/usr/src/sendmail/cf/cf/linux.asyoulike.mc # Bernhard's sendmail.cf include(`../m4/cf.m4')dnl # must be!!! VERSIONID(`asyoulike')dnl # name it as you like OSTYPE(linux)dnl # We're doing Linux! FEATURE(nodns)dnl # No own name server FEATURE(nocanonify)dnl # Don't lookup DNS while sending FEATURE(nouucp)dnl # We don't use UUCP define(SMART_HOST, relay:<provider.name>)dnl # mail to ... define(confCON_EXPENSIVE, True)dnl # distributing mail is expensive MASQUERADE_AS(lrz.uni-muenchen.de)dnl # we act as "provider" define(confUSERDB_SPEC, /etc/userdb.db)dnl # Address correction FEATURE(notsticky)dnl # don't change From: line MAILER(local)dnl # use mailer: MAILER(smtp)dnl # local, Simple Mail Transfer Prot.You just must tell sendmail this now:
root:# m4 linux.asyoulike.mc > /etc/sendmail.cf root:# _Writing emails you have to tell your address so that a "reply" works properly. This means, the From: line in the email header must contain your account name at your provider. This happens because of the line "MASQUERADE_AS ..." in the m4 script, and because of a user database built in there. This database (/etc/userdb.db) also must be prepared, therefore you must create a file containing two lines per user:
/etc/userdb.db <login_at_your_pc>:mailname <provider_login_name> <provider_login_name>:maildrop <login_at_your_pc>It must be changed to a format sendmail can read:
root:# makemap btree /etc/userdb.db < /etc/userdb root:# _(sendmail-FAQ tells that this only works, if you have the Berkeley db package - the S.u.S.E. 4.2 installs it.)
Now you have after a reboot (or after killing sendmail and restarting it with the option "-bd") a working mail slave.
Sendmail is running as daemon in the background. You can tell him to collect all the email you wrote (it will be stored in /var/spool/mqueue or /var/mqueue), and to send it on demand only.
Therefore you must start sendmail while booting as daemon without the "-q ..." option. In simpleinit environment this happens in the last part of the startup script /etc/rc.d/rc.M; if you have sysvinit it is in an extra file (SuSE 4.2: /sbin/init.d/sendmail. Here you must remove this option; "-bd" must remain, because it is the command for sendmail to go into background as daemon.
But there are some mail programs which are something obstinate. Programs like pine or Netscape overwrite the header with some entries, which are not correct.
Netscape
For Netscape you can edit the file ~/.netscape/preferences. In it you find the line
~/.netscape/preferences (cutting) [...] EMAIL_ADDRESS: <Email@Address> [...]Type in your correct email address.
Pine hides this problem much better. It is so well hidden that I could not find out how to fix it. Because pine is my preferred mailer program I'm very sorry about it. Does anyone know how to solve this problem? Problem: It is easy to set the domain name in setup or in the file ~/.pinerc, but it semms impossible to set the user name correctly. Seems I have to write a patch :-(
XEmacs
(Thanks, Markus Dickebohm <m.dickebohm@uni-koeln.de> for sending me these hints!)
You can fake the From: address within XEmacs, if you edit the file ~/.emacs and add the following entries:
(setq user-mail-address "m.dickebohm@uni-koeln.de") (setq mail-host-address "mail.rrz.uni-koeln.de")This is not ideal, like the mailer programs above: this mailer changes the mailer header.
More Mailers
If you have information about other MUAs (Mail User Agents), please send them to me. Thank you!
~:# popclient -3 -u<host-login> -p<host-password> -o/var/spool/mail/<user> getmail ~:# _getmail is the mailhost defined in /etc/hosts. If you give an additional "-k" as option, the emails at the provider will not be erased.
/sbin/transmail #!/bin/sh # transmail.sh: exchanges email with the provider. # Author: Bernhard Hailer <dl4mhk@lrz.uni-muenchen.de> # Version: 3.0 (01-Sep-96) . /etc/i4l.config . /etc/i4l.param cd / # against PATH=. effect echo ----------------------------------------------------------------------- echo -e "Starting mail transfer: \c"; date declare -i con_apps # makes it comfortable read con_apps </etc/lines.active let con_apps+=1 echo $con_apps >/etc/lines.active line="0" while [ $line!="finished" ] do if [ $con_apps -lt 2 ] then echo "Calling ippp$line" /sbin/isdnctrl dial ippp$line echo "Sleeping 8 sec for PPP handshaking..." sleep 8s /sbin/route add default ippp$line echo "Line open - checking server..." else let con_apps-=1 echo "Line seems to be open already $con_apps time(s) - checking..." let con_apps+=1 fi echo "Checking Server..." set `ping -qc5 -i1 prvdr$line | grep transmitted` if [ $4 -gt 0 ]; then echo ":-) Dial-in server running - checking mail server..." set `ping -qc5 -i1 getmail | grep transmitted` if [ $4 -gt 0 ]; then echo "8-) Mail server online - starting mail exchange" echo "Sending mail..." sendmail -q echo "Again sleeping 2 sec for PPP handshaking" sleep 2 echo "Fetching mail..." popclient -3 -u $MAIL_LOGIN -p $MAIL_PASSWD -o $MAIL_PATH getmail echo "Again sleeping 2 sec for PPP handshaking" sleep 2 line="finished" # paranoia setting break else echo ":-[ Sorry - mail server is down. Try later..." line="finished" # paranoia setting break fi else /sbin/isdnctrl hangup ippp$line route del default read con_apps </etc/lines.active echo "0" >/etc/lines.active if [ $con_apps -gt 0 ] then echo ":-| Hmm, no. Trying to rebuild..." let con_apps=1 echo $con_apps >/etc/lines.active line="0" # paranoia setting continue else case $line in 0) if [ $PROV_NAME_2 = "" ] then echo ":-[ Sorry, Line is down. Bad luck... Try later!" line="finished" echo "0" >/etc/lines.active con_apps=1 break else echo ":-( Sorry, Line 0 is down. Trying second line." line="1" continue fi ;; 1) echo ":-[ Sorry, Line 1 is also down. Bad luck... Try later!" line="finished" echo "0" >/etc/lines.active con_apps=1 break ;; *) echo ":-0 THIS CANNOT HAPPEN. Fatal Error in script /sbin/transmail!" break ;; esac fi fi done read con_apps </etc/lines.active let con_apps-=1 echo $con_apps >/etc/lines.active if [ $con_apps -eq 0 ] then echo "Last application stopped - closing line." /sbin/isdnctrl hangup ippp0 /sbin/isdnctrl hangup ippp1 /sbin/route del default # and delete route. else echo "There are $con_apps more applications running - keeping line." fi # allow dl4mhk access to mail: chown dl4mhk.users /var/spool/mail/dl4mhk echo -e "Finished mail transfer: \c"; dateThe sleep commands are important: the connection may hang without them.
1.) modify cron table.
root:# cd ~ root:# cp /var/spool/cron/crontabs/root .crontab root:# _Append the following lines to the file .crontab:
# Transfer mail 30 04 * * * /sbin/transmail.sh 1>> /var/log/transmail-log 2>> /var/log/transmail-log2.) Tell crond these modifications.
crontab .crontabNow the clock in the computer automatically handles all the emails. Each night at 4:30 a.m. the mails are fetched and sent. Remark: Of course the system time must be set properly - man date; man clock.
You need to calculate what's more expensive: telephone or electricity. Electricity is expensive. But I use this system because it is so comfortable...