Read local Unix mail in Mail.app
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/lib:/usr/local/include:/usr/bin:/bin:/usr/sbin:/sbin" # create a SSL certificate # cf. http://www.npcole.com/usingimaptiger.html # NOTE: put "localhost" in the "Common Name" field cd /System/Library/OpenSSL/certs sudo openssl req -new -x509 -nodes -days 3650 -out ipop3d.pem -keyout ipop3d.pem # If Mail.app later complains about the newly created certificate, just: - Click "Show Certificate" - Alt-Drag the icon for the certificate onto your desktop. - Double-click the file. - In the dialog box that will appear, use the drop down list to add the key to the "X509Anchors" keychain. openssl x509 -in /System/Library/OpenSSL/certs/ipop3d.pem -noout -fingerprint -subject -issuer sudo ln -s /usr/include/pam /usr/include/security sudo cp -p /private/etc/pam.d/ftpd /private/etc/pam.d/pop #sudo cp -p /private/etc/pam.d/login /private/etc/pam.d/pop cd ~/Desktop curl -L -O http://www.macosxguru.net/downloads/localmail.zip unzip -qq localmail.zip sudo mkdir -p /usr/local/libexec sudo cp ~/Desktop/localmail/ipop3d /usr/local/libexec/ sudo chown root:wheel /usr/local/libexec/ipop3d sudo chmod 755 /usr/local/libexec/ipop3d sudo cp ~/Desktop/localmail/edu.washington.pop3s.plist /Library/LaunchDaemons/edu.washington.pop3s.plist sudo nano /Library/LaunchDaemons/edu.washington.pop3s.plist <?xml version="1.0" encoding="UTF-8"?> DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple. com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Labelkey>edu.washington.pop3s< /string> <key>ProgramArgumentskey>/usr/local/libexec/ipop3dstring> </array> <key>Socketskey> /key> <dict> <key>Bonjourkey> Listeners< /> <key>SockServiceNamekey> pop3s< /string> <key>SockTypekey>stream< /string> dict> </dict> <key>inetdCompatibilitykey>/key> <false/> dict> </dict> plist> sudo chown root:wheel /Library/LaunchDaemons/edu.washington.pop3s.plist sudo chmod 644 /Library/LaunchDaemons/edu.washington.pop3s.plist your_logname="$(/usr/bin/logname)" echo $your_logname sudo cp -p /private/etc/postfix/canonical /private/etc/postfix/canonical.orig sudo nano /private/etc/postfix/canonical <your_logname>: <your_logname>@localhost sudo nano /private/etc/postfix/smtpd.conf auxprop_plugin: login pwcheck_method: auxprop mech_list: plain login sudo cp -p /private/etc/postfix/access /private/etc/postfix/access.orig sudo nano /private/etc/postfix/access localhost OK <your_logname>@localhost OK <your_logname>@local.local OK # cf. man hostname <your_logname>@<your_hostname> OK # see man 5 postconf # check with postconf -n sudo nano /private/etc/postfix/main.cf biff = no command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 disable_vrfy_command = yes html_directory = /private/etc/postfix/html inet_interfaces = all mail_owner = postfix mailq_path = /usr/bin/mailq manpage_directory = /usr/local/man mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mydomain = localdomain myhostname = localhost.localdomain mynetworks = 127.0.0.0/24 mynetworks_style = host myorigin = $mydomain newaliases_path = /usr/bin/newaliases queue_directory = /var/spool/postfix readme_directory = /private/etc/postfix/readme relayhost = [127.0.0.1] #relayhost = [SMTP_server_address_of_your_ISP] sample_directory = /etc/postfix sender_canonical_maps = hash:/etc/postfix/canonical sendmail_path = /usr/sbin/sendmail setgid_group = postdrop smtp_tls_cert_file = $smtpd_tls_cert_file smtp_tls_key_file = $smtpd_tls_cert_file smtp_tls_loglevel = 3 smtp_tls_note_starttls_offer = yes smtp_tls_scert_verifydepth = 5 smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_tls_session_cache smtp_use_tls = yes smtpd_client_restrictions = check_client_access hash:/etc/postfix/access, reject_unknown_client smtpd_helo_required = yes smtpd_helo_restrictions = permit_mynetworks, reject_invalid_hostname, reject_non_fqdn_hostname smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, reject_non_fqdn_recipient smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/access, reject_unknown_sender_domain smtpd_tls_auth_only = yes smtpd_tls_cert_file = /System/Library/OpenSSL/certs/ipop3d.pem smtpd_tls_key_file = $smtpd_tls_cert_file smtpd_tls_loglevel = 3 smtpd_tls_received_header = yes smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_tls_session_cache smtpd_use_tls = yes tls_random_source = dev:/dev/urandom unknown_local_recipient_reject_code = 550 # reload Postfix function rpf() { /usr/bin/sudo /usr/sbin/postmap /private/etc/postfix/access /usr/bin/sudo /usr/sbin/postalias hash:/private/etc/postfix/canonical /usr/bin/sudo /usr/bin/newaliases /usr/bin/sudo /usr/sbin/postfix reload /usr/bin/sudo /bin/launchctl unload -w /Library/LaunchDaemons/edu.washington.pop3s.plist 2>/dev/null /usr/bin/sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/org.postfix.master.plist 2>/dev/null /bin/sleep 2 /usr/bin/sudo /bin/launchctl load -w /Library/LaunchDaemons/edu.washington.pop3s.plist 2>/dev/null /usr/bin/sudo /bin/launchctl load -w /System/Library/LaunchDaemons/org.postfix.master.plist 2>/dev/null return 0 } rpf sudo ln -s "/Applications/Utilities/Network Utility.app/Contents/Resources/stroke" /bin/portscan portscan localhost 1 1000 # Open TCP Port: 25 smtp; Open TCP Port: 995 pop3s # now create a new mail account in Mail.app Account Description: POP Account Full Name: Your Name Email Address: <your_logname>@localhost User Name: <your_logname> Password: <your system user account password> Incoming Mail Server: localhost SSL: on Outgoing Mail Server: localhost SSL: on Mail -> Preferences ... -> Accounts -> POP Account -> Account Information -> Server Settings ...: - Server port: 25 - Use SSL -> [yes] - Authentication -> None Mail -> Preferences ... -> Accounts -> POP Account -> Advanced: - Port: 995 - Use SSL -> [yes] - Authentication -> Password # ignore error message ... The POP server "localhost" is not responding. Check your network connection and that you entered the correct information in the "Incoming Mail Server" field. If it still doesn't respond, the server might be temporarily unavailable. If you continue, you may not be able to receive any email. # ... but make sure SSL is actually being used in: - Mail -> Preferences ... -> Accounts -> POP Account -> Account Information -> Server Settings ... - Mail -> Preferences ... -> Accounts -> POP Account -> Advanced # now quit Mail.app and save the changes made in Mail -> Preferences ... -> Accounts -> POP Account ... if necessary open -a Mail # dialog box 1: - Enter Password for Account "POP Account" - Please enter the password for user Wait< on POP server "localhost" - 'Keychain Access' # cf. dialog box 1 above Keychains -> login -> localhost -> click [i] -> Attributes Name: localhost Kind: Internet password Account:- [yes] Remember this password in my keychain # dialog box 2: - Unable to verify SSL server localhost - Mail was unable to verify the identity of this server, which has a certificate issued to "localhost". The error was: - The root certificate for this server could not be verified. - ... # Once again: if Mail.app complains about the newly created SSL certificate in the above way, just: - Click "Show Certificate" - Alt-Drag the icon for the certificate onto your desktop. - Double-click the file. - In the dialog box that will appear, use the drop down list to add the key to the "X509Anchors" keychain. - enter your system user account password if prompted killall Mail # check Keychain Access items open -a Where: pop://localhost Modified: 'hello world' | mail -s 'test mail' $(logname)@localhost open -a MailKeychains -> login -> localhost -> click [i] -> Access Control - [yes] Confirm before allowing access #- [yes] Ask for Keychain password - Always allow access by these applications: Name: Mail, Location: /Applications, Version: ... # cf. dialog box 2 above Keychains -> X509Anchors -> [Click to unlock the X509Anchors keychain] -> select "localhost - certificate -- X509Anchors" -> click [i] -> Trust Settings -> select Use System Settings or Always Trust #------------------- # test # curl -L -O http://www.unflyingobject.com/tarkvara/files/ssldump.zip open /bin/bash sudo ssldump -i lo0 port 995 open /bin/bash sudo tcpdump -i lo0 port 995 and host localhost # test echo
Further information:
- How to read local Unix mail in Mail.app under Tiger?
- Enable postfix without inducing insomnia
- What is the difference between POP and IMAP?
- Setting up a local IMAP archive of your mail on Tiger
- Setting up IMAP in Apple Mail