Galler

Q: Yosemite Server fetch mails

Hi

 

Trying to setup me old E-Mail server environment, but I could not find fetchmail. Is this still available on Yosemite server. If not how can I fetch mails then from my Mailspace and route to a Users. Any help would be highly appreciated. I`m really struggling with that topic.

 

Cheers

Mac mini, OS X Server, Yosemite

Posted on Nov 21, 2014 3:30 PM

Close

Q: Yosemite Server fetch mails

  • All replies
  • Helpful answers

  • by Michael Newbery,

    Michael Newbery Michael Newbery Nov 22, 2014 5:04 PM in response to Galler
    Level 4 (2,424 points)
    Servers Enterprise
    Nov 22, 2014 5:04 PM in response to Galler

    fetchmail ceased to be bundled with server a while ago (it was last bundled with Lion), but it still works.

     

    You'll need Xcode installed in order to do the next step, since we are compelling from source.

     

    1. Download fetchmail sources from: http://sourceforge.net/projects/fetchmail/
    2. unzip it to the destination you want.
    3. cd to the appropriate directory
    4. type: ./configure ENTER
    5. type: make  ENTER
    6. type: sudo make install ENTER

     

    I've got it in /usr/local (bin/ and etc/) so on my setup, fetchmail is run from launchd with the command /usr/local/bin/fetchmail -f /usr/local/etc/fetchmailrc and set to re-launch if the path /usr/local/etc/fetchmailrc changes.

     

    /Library/LaunchDaemons/local.fetchmail.plist

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

    <plist version="1.0"> <dict>         <key>Label</key>         <string>local.fetchmail</string>         <key>ProgramArguments</key>         <array>                 <string>/usr/local/bin/fetchmail</string>                 <string>-f</string>                 <string>/usr/local/etc/fetchmailrc</string>         </array>         <key>RunAtLoad</key>         <true/>       <key>StartInterval</key>   <integer>120</integer>         <key>WatchPaths</key>         <array>                 <string>/usr/local/etc/fetchmailrc</string>         </array>         <key>StandardOutPath</key>         <string>/var/log/fetchmail.stdout</string>         <key>StandardErrorPath</key>         <string>/var/log/fetchmail.stderr</string>         <key>ProcessType</key>         <string>Background</key> </dict> </plist>

     

    Get the SSL fingerprints for the appropriate servers, with

    openssl s_client -connect pop.mail.yahoo.com:995 -showcerts | openssl x509 -fingerprint -noout -md5


    And fetchmailrc looks like:

    /usr/local/etc/fetchmailrc

    # set syslog # sendmail is not running. Need to deliver to Dovecot, on LMTP # Dovecot users are just "x", not "x@localhost", so the usernames all need to be specified # using smtpname, which explicitly sets the whole name (so if you don't include '@' it doesn't # put it in for you---which is what we need here). # # # Yahoo poll Yahoo   proto pop3   auth password   via pop.mail.yahoo.com   user "USERNAME"   pass "PASSWORD"   smtpname localusername   ssl   sslfingerprint '11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00'   smtp /var/run/dovecot/lmtp
  • by Galler,

    Galler Galler Nov 24, 2014 5:45 AM in response to Michael Newbery
    Level 1 (0 points)
    Nov 24, 2014 5:45 AM in response to Michael Newbery

    Wow Michael

     

    That answere solved my issue in total, worked from the scratch. Thanks a lot for your help.

     

    Cheers

  • by Michael Newbery,

    Michael Newbery Michael Newbery Nov 24, 2014 10:41 AM in response to Galler
    Level 4 (2,424 points)
    Servers Enterprise
    Nov 24, 2014 10:41 AM in response to Galler

    I was pleased to be able to help. I document what I've done for my own records, (it's easy to forget the details otherwise when a new OS version comes along, or I need to reinstall), so it was all there, and thus easy to share.

  • by Galler,

    Galler Galler Nov 27, 2014 8:39 AM in response to Michael Newbery
    Level 1 (0 points)
    Nov 27, 2014 8:39 AM in response to Michael Newbery

    Michael

     

    Could you explain the steps how to fetchmail via SSL. So far I was able to fetchmail just unsecured, now I wanna make the next step forward.

    I was able to get the fingerprint but it seems that is not all what is needed. Thanks again for your help.

     

    Cheers

  • by Michael Newbery,Solvedanswer

    Michael Newbery Michael Newbery Nov 28, 2014 3:24 PM in response to Galler
    Level 4 (2,424 points)
    Servers Enterprise
    Nov 28, 2014 3:24 PM in response to Galler

    To use SSL, first the web site needs to support it. Normally, for each provider, you search for POP and IMAP support and look up what they tell you to do (what servers you need to use) to access them

     

    So, for instance, if you are using SSL and POP on pop.example.com, and it says use port 998, then you need to fetch the SSL finger print using

     

    openssl s_client -connect pop.example.com:995 -showcerts | openssl x509 -fingerprint -noout -md5


    If you are using SSL and IMAP in map.mail.example.com and it says use port 993, then the command is

     

    openssl s_client -connect map.mail.example.com:993 -showcerts | openssl x509 -fingerprint -noout -md5


    Then you need to set up fetchmailrc appropriately.


    So, if you were using POP, on Yahoo, and your Yahoo account was ME_YAHOO with password PASSW0RD and you want mail delivered to REAL_ME on the server, it looks something like:

    poll Yahoo
      proto pop3
      auth password
      via pop.mail.yahoo.com
      user "ME_YAHOO"
      pass "PASSW0RD"
      smtpname REAL_ME
      ssl
      sslfingerprint '11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00'
      smtp /var/run/dovecot/lmtp
    


    If you were using IMAP on example.com it might look like

    poll Example
      proto imap
      via imap.mail.example.com
      user "ME_YAHOO"
      pass "PASSW0RD"
      smtpname REAL_ME
      sslfingerprint '11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00'
      smtp /var/run/dovecot/lmtp
    


    You may or may not need the ssl keyword, and the auth password. You need to tune for each server.

  • by Galler,

    Galler Galler Nov 30, 2014 3:10 PM in response to Michael Newbery
    Level 1 (0 points)
    Nov 30, 2014 3:10 PM in response to Michael Newbery

    Thanks Micheal works perfectly. Cheers

  • by Michael Newbery,

    Michael Newbery Michael Newbery Nov 30, 2014 8:04 PM in response to Galler
    Level 4 (2,424 points)
    Servers Enterprise
    Nov 30, 2014 8:04 PM in response to Galler

    Glad I could help.

  • by munkhtulga_cs,

    munkhtulga_cs munkhtulga_cs Dec 25, 2014 6:56 PM in response to Galler
    Level 1 (0 points)
    Dec 25, 2014 6:56 PM in response to Galler

    Hello? I'm trying to configure email server on Yosemite v10.10. But what applications need to create email server? Please tell me if your server works fine?

  • by RulerJvdV,

    RulerJvdV RulerJvdV Mar 19, 2015 3:53 PM in response to Michael Newbery
    Level 1 (0 points)
    Mar 19, 2015 3:53 PM in response to Michael Newbery

    Hi Michael,

     

    Nice explanation, thanks !

     

    One point, the plist file gave me an "109: Invalid property list"

    After running plutil -lint /Library/LaunchDaemons/local.fetchmail.plist

    It pointed out that the part <string>Background</key> gave the error.

    Changed it to <string>Background</string> and now it works perfectly on a OSX 10.10 mini server.

     

    Regards,

    John

  • by Michael Newbery,

    Michael Newbery Michael Newbery Mar 19, 2015 6:46 PM in response to RulerJvdV
    Level 4 (2,424 points)
    Servers Enterprise
    Mar 19, 2015 6:46 PM in response to RulerJvdV

    Thanks for pointing that out.

     

    I just checked /Library/LaunchDaemons/local.fetchmail.plist and found that is does in fact end

     

      <string>Background</string>
    </dict>
    </plist>

    so it appears the error was in my transcription

  • by Kanzler71,

    Kanzler71 Kanzler71 Sep 14, 2016 2:08 PM in response to Michael Newbery
    Level 1 (4 points)
    Sep 14, 2016 2:08 PM in response to Michael Newbery

    Hi Michael,

     

    have you tried fetchmail - and your tutorial on El Capitan Server.

    I an thinking of migrating my servers from Mavericks to El Capitan.

    The first test migration turned out bad, fetchmail wouldn't work.

     

    Regards

    Felix