Skip to content

Instantly share code, notes, and snippets.

@benmaughan
benmaughan / Postfix: sender-dependent SASL authentication.md
Created October 12, 2016 21:34 — forked from zmwangx/Postfix: sender-dependent SASL authentication.md
Postfix: sender-dependent SASL authentication — relay to multiple SMTP hosts, or relay to the same host but authenticate as different users (e.g., two Gmail accounts)

This is a sequel to "Postfix: relay to authenticated SMTP".

I would like to send mail from two different Gmail accounts using Postfix. Here is the relevant section in the Postfix documentation: Configuring Sender-Dependent SASL authentication.

As a concrete example, here's how to set up two Gmail accounts (only relevant sections of the config files are listed below):

/etc/postfix/main.cf:
    # sender-dependent sasl authentication
    smtp_sender_dependent_authentication = yes

sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay

@benmaughan
benmaughan / move-file-here.el
Last active April 22, 2016 08:37
Move a file from somewhere else to here.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; move file here ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'dash)
(require 'swiper)
;; start directory
(defvar bjm/move-file-here-start-dir (expand-file-name "~/downloads"))
(defun bjm/move-file-here ()
@benmaughan
benmaughan / mailcount.pl
Created April 18, 2016 20:22
Count number of emails in inbox, drafts and outbox for mail indexed with mu and sent with sendmail or equivalent
#!/usr/bin/perl -w
###########################################################################
#
# Count number of emails in inbox, drafts and outbox for mail indexed
# with mu and sent with sendmail or equivalent
#
# by Ben Maughan
# http://www.pragmaticemacs.com
#
@benmaughan
benmaughan / readme.markdown
Created November 29, 2015 23:01 — forked from larrybotha/readme.markdown
Postfix Using Gmail SMTP in Mac OSX Mavericks