Subscribe via

Setting up Sendmail on FreeBSD 6.2

Thaya Kareeson

Previously, I mentioned that I was not able to successfully send emails via sendmail. This functionality is quite useful because WordPress, among other things, uses sendmail to send emails to you when someone leaves a comment on your post. So it turns out that because most public mail servers (i.e. gmail, hotmail, etc) do not trust my “omninoggin.com” mail server domain, all messages I sent were refused. After hours of research, I found out that I can route my mail traffic through my internet service provider’s mail proxy (SBC Yahoo!) to get this to work.

I started by following the Open Addict tutorial section “Configuring Mail Services”. After the step “Edit the [hostname].mc file, add these lines, I put mine above DAEMON_OPTIONS,” I stopped following the tutorial and did the following:

  1. Add these lines into my [hostname].mc file (above DAEMON_OPTIONS). Also note that “smtp.sbc.mail.yahoo4.akadns.net” is SBC Yahoo’s mail proxy server.
    define(`confAUTH_OPTIONS', `A')dnl
    define(`confAUTH_MECHANISMS', `PLAIN LOGIN')dnl
    TRUST_AUTH_MECH(`PLAIN LOGIN')dnl
    FEATURE(`authinfo',`hash /etc/mail/authinfo')dnl
    define(`SMART_HOST',`smtp.sbc.mail.yahoo4.akadns.net')dnl
  2. Create the file /etc/mail/authinfo and put the following into it (all in one line) and save (also make sure you replace <your-username> and <your-password> with your real username and password):
    AuthInfo:smtp.sbc.mail.yahoo4.akadns.net
    "U:<your-username>@sbcglobal.net"
    "I:<your-username>@sbcglobal.net"
    "R:sbcglobal.net" "P:<your-password>" "M:PLAIN"
  3. Run the following command:
    makemap hash /etc/mail/authinfo < /etc/mail/authinfo
  4. Set sendmail to start (and listen) at boot, so add this to /etc/rc.conf:
    sendmail_enable="YES"
  5. Create the file /etc/mail/local-host-names and insert your domain name(s) to accept mail for. Then, finish the sendmail re-build.
    touch /etc/mail/local-host-names
    make all install restart
  6. Send a test email to yourself
    sendmail -f "webmaster@your-domain.com" -F "webmaster"
    From: Webmaster <webmaster@your-domain.com>
    To: your.other@email.com
    Subject: Hello World!
    Hello World!
    .

This should work but in case it doesn’t, there is some good troubleshooting information on DSL Reports. It took me 5 hours to figure this out so good luck!

Save and Share
Del.icio.us
StumbleUpon
Digg
Reddit

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Currently experiencing problems with Intense Debate commenting system. Please make sure your browser's Javascript is enabled and try again later.