Frequently Asked Questions for FreeBSD 2.X : System Administration : How do I set up mail with a dialup connection to the 'net?
Previous: How do I use sendmail for mail delivery with UUCP?
Next: Eek! I forgot the root password!

8.19. How do I set up mail with a dialup connection to the 'net?

If you've got a statically assigned IP number, you should not need to adjust anything from the default. Set your host name up as your assigned internet name and sendmail will do the rest.

If you've got a dynamically assigned IP number and use a dialup ppp connection to the internet, you will probably be given a mailbox on your ISPs mail server. Lets assume your ISPs domain is myISP.com, and that your user name is user. Lets also assume you've called your machine bsd.home and that your ISP has told you that you may use relay.myISP.com as a mail relay.

In order to retrieve mail from your mailbox, you'll need to install a retrieval agent. Fetchmail is a good choice as it supports many different protocols. Usually, POP3 will be provided by your ISP. If you've chosen to use user-ppp, you can automatically fetch your mail when a connection to the 'net is established with the following entry in /etc/ppp/ppp.linkup:

        MYADDR:
          !bg su user -c fetchmail
      

If you are using sendmail (as shown below) to deliver mail to non-local accounts, put the command

	  !bg su user -c "sendmail -q"
      

after the above shown entry. This forces sendmail to process your mailqueue as soon as the connection to the 'net is established.

I'm assuming that you have an account for user on bsd.home. In the home directory of user on bsd.home, create a .fetchmailrc file:

        poll myISP.com protocol pop3 fetchall pass MySecret;
      

Needless to say, this file should not be readable by anyone except user as it contains the password MySecret.

In order to send mail with the correct from: header, you must tell sendmail to use user@myISP.com rather than user@bsd.home. You may also wish to tell sendmail to send all mail via relay.myISP.com, allowing quicker mail transmission.

The following .mc file should suffice:

        VERSIONID(`bsd.home.mc version 1.0')
        OSTYPE(bsd4.4)dnl
        FEATURE(nouucp)dnl
        MAILER(local)dnl
        MAILER(smtp)dnl
        Cwlocalhost
        Cwbsd.home
        MASQUERADE_AS(`myISP.com')dnl
        FEATURE(allmasquerade)dnl
        FEATURE(masquerade_envelope)dnl
        FEATURE(nocanonify)dnl
        FEATURE(nodns)dnl
        define(SMART_HOST, `relay.myISP.com')
        Dmbsd.home
        define(`confDOMAIN_NAME',`bsd.home')dnl
        define(`confDELIVERY_MODE',`deferred')dnl
      

Refer to the previous section for details of how to turn this .mc file into a sendmail.cf file. Also, don't forget to restart sendmail after updating sendmail.cf.


Frequently Asked Questions for FreeBSD 2.X : System Administration : How do I set up mail with a dialup connection to the 'net?
Previous: How do I use sendmail for mail delivery with UUCP?
Next: Eek! I forgot the root password!