Linux Home
Automation

(Last updated: Tuesday, April 17, 2007)
Google
 

Linux, Sendmail and Comcast.net

Last updated: Tuesday, April 17, 2007

Recently Comcast changed it's sending mail port from port 25 to port 587 for some (???) end users. Here's my rant on that subject. It got a little long and detracted from the main subject of this page.

I'm now also able to use Gmail with sendmail. For more details on that setup see my Linux, Sendmail and Google mail page. This is my current working setup.

Now for Sendmail, it's a lot more complicated than just changing a mail sending port number from 25 to 587. There are things to check and lots of little configuration changes to make. Before you start wondering why are you going through this exercise remember that with power comes responsibilty. Sendmail is very power. So lets start with the files you will need to change:

  • /etc/mail/sendmail.mc
  • /etc/mail/auth/client-info

This is where the files are on my Linux box (Fedora FC 6). Changes I made to /etc/mail/sendmail.mc (added to the end of the file):

    dnl # Changes I made to /etc/mail/sendmail.mc
    define(`SMART_HOST',`smtp.comcast.net')
    define(`RELAY_MAILER_ARGS', `TCP $h 587')
    define(`ESMTP_MAILER_ARGS', `TCP $h 587')
    define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
    FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl

    FEATURE(`no_default_msa',`dnl')dnl
    FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
    FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
    FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
    FEATURE(redirect)dnl
    FEATURE(always_add_domain)dnl
    FEATURE(use_cw_file)dnl
    FEATURE(use_ct_file)dnl
    
    MASQUERADE_AS(`comcast.net')dnl
    FEATURE(masquerade_envelope) FEATURE(genericstable, `hash -o /etc/mail/genericstable')
    GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl
    MAILER(smtp)dnl
    MAILER(procmail)dnl

Later I'll explain the virtusertable and mailertable entries. I needed all of that so other devices throughout my network can send email to my local machines or to users on the internet.

Changes I made to /etc/mail/submit.mc (added to the end of the file):

    FEATURE(`msp', `[127.0.0.1]')dnl

If you don't have an /etc/mail/auth directory, as root, create one like this:

    # mkdir -p /etc/mail/auth
    # chmod 700 /etc/mail/auth

You won't have the next client-info files so you'll have to create it (with you favorite Unix editor). Change the permissions on the client-info file like this:

    # chmod 600 client-info

So as user_id@comcast.net I made the following entry in /etc/mail/auth/client-info:

    # cat /etc/mail/auth/client-info
    AuthInfo:smtp.comcast.net "U:smmsp" "I:user_id" "P:password" "M:PLAIN"
    AuthInfo:smtp.comcast.net:587 "U:smmsp" "I:user_id" "P:password" "M:PLAIN"

Remember to replace user_id with your Comcast email ID (your email addresse without the @comcast.net) and password with your email password. Also make sure that the client-info file has tight permissions so nobody can read your password.

How to compile it into a db file:

    # cd /etc/mail/auth
    # makemap -r hash client-info.db < client-info

And finally make sure your running the latest cf files since your mc file changes:

    # cd /etc/mail
    # make

And lastly restart sendmail:

    # service restart sendmail

Changing the sender on outgoing email

One of the things I wanted to do was to correct the sender's email address that was being used on outgoing email. I frequently have processes that send email and run as 'other' users on my server. What I'd like to see is instead of this:

  • cookie!cookie!asterisk@comcast.net

I'd rather see this:

  • ncherry@linuxha.com

That way if the mail ends up in the wrong place at least the person can reply and let me know that my mail was accidently received by them. The good news is that it's not hard to do with Sendmail. Just add these lines to your /etc/mail/sendmail.mc file:

    GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl

Now edit the /etc/mail/genericsdomain file and add the entries you want changed, like this:

    cookie!cookie!asterisk ncherry@linuxha.com

Now compile it into a db file:

    # cd /etc/mail
    # makemap -r hash genericstable.db < genericstable

And finally make sure your running the latest cf files since your mc file changes:

    # cd /etc/mail
    # make

And lastly restart sendmail:

    # service restart sendmail

Linux, Sendmail and Gmail

So far I haven't attempted this with Gmail. I did have Sendmail working with my 1 and 1 web service for this site. Unfortunately when my home server crashed and it took out something (yes I have it backed up). You'll need to use the alternate port 587 or 456, you need to have TLS correctly setup (I think this is my current problem with 1 and 1) and you'll need to correctly setup your AuthInfo files. This means you'll have to have OpenSSL installed, which I think is normally installed with most Linux distributions.

Incoming Mail (POP3) Server - requires SSL: pop.gmail.com
Use SSL: Yes
Port: 995
Outgoing Mail (SMTP) Server - requires TLS: smtp.gmail.com (use authentication)
Use Authentication: Yes
Use STARTTLS: Yes (some clients call this SSL)
Port: 465 or 587
Account Name: your Gmail username (including @gmail.com)
Email Address: your full Gmail email address (username@gmail.com)
Password: your Gmail password

Notes:

For now this was a rush job to get this out while I still remember what I did. I'd also like to have a backup (Gmail) so if I run into further problems I can use Gmail instead. Lastly I'll try to document what I did to change the return address from ncherry!cookie!cookie@comcast.net to ncherry@comcast.net. That really annoyed me for a while. I'm guessing that many others haven't run into this problem as they're probably not using UUCP. I'm not really using it but I do use .uucp as my home local domain. I have a DNS that resolves the entire .uucp domain (that's in my home :-).