Skip to content

Commit

Permalink
rev sendgrid#2, now receives mail with this test plan:
Browse files Browse the repository at this point in the history
- mail_send.send_to_self_basic([email protected])
- test_event_inbox.validate_processed_event(timeout_seconds=240,auto_validate=True)
- test_event_inbox.validate_delivered_event(timeout_seconds=240,auto_validate=True)
  • Loading branch information
chrismead-sg committed Sep 18, 2015
1 parent e24801c commit 3200c27
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 103 deletions.
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM docker.sendgrid.net/sendgrid/dev_pl
FROM docker.sendgrid.net/sendgrid/dev

RUN yum install postfix
RUN yum install -y postfix

WORKDIR /opt/sendgrid/postfix

ADD master.cf /etc/postfix/master.cf
ADD aliases.erb /etc/aliases
ADD main.cf.erb /etc/postfix/main.cf
ADD sg_mail.erb /etc/logrotate.d/sg_mail
ADD mailname.erb /etc/mailname
ADD aliases /etc/aliases
ADD main.cf /etc/postfix/main.cf
ADD sg_mail /etc/logrotate.d/sg_mail
ADD mailname /etc/mailname

RUN service postfix restart
#RUN service postfix start
File renamed without changes.
1 change: 1 addition & 0 deletions mailname
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mxpostfix.docker
1 change: 0 additions & 1 deletion mailname.erb

This file was deleted.

61 changes: 61 additions & 0 deletions main.cf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = /usr/libexec/postfix

data_directory = /var/lib/postfix


mail_owner = postfix

myhostname = mxpostfix.docker

myorigin = /etc/mailname
inet_interfaces = $myhostname


inet_protocols = all

mydestination = bounced.docker, localhost


unknown_local_recipient_reject_code = 550



alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

#recipient_delimiter = +



debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix


newaliases_path = /usr/bin/newaliases.postfix


mailq_path = /usr/bin/mailq.postfix


setgid_group = postdrop


html_directory = no


manpage_directory = /usr/share/man


sample_directory = /usr/share/doc/postfix-2.6.6/samples


readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
60 changes: 0 additions & 60 deletions main.cf.erb

This file was deleted.

95 changes: 60 additions & 35 deletions master.cf.erb → master.cf
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,45 @@
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
#submission inet n - - - - smtpd
smtp inet n - n - - smtpd
#submission inet n - n - - smtpd
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#smtps inet n - - - - smtpd
#smtps inet n - n - - smtpd
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
#628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - - 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
smtp unix - - n - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - - - - smtp
relay unix - - n - - smtp
-o smtp_fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
Expand All @@ -61,45 +61,70 @@ scache unix - - - - 1 scache
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#uucp unix - n n - - pipe
# flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# ====================================================================
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)

bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
#
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
${nexthop} ${user} ${extension}
#
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}

bounced unix - - n - 20 smtp
-o smtp_send_xforward_command=yes
-o smtp_discard_ehlo_keywords=8bitmime,startssl

127.0.0.1:10028 inet n - n - 10 smtpd

0.0.0.0:10028 inet n - n - 10 smtpd
-o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
-o mynetworks=172.17.0.0/16
-o smtpd_authorized_xforward_hosts=172.17.0.0/16

127.0.0.1:10030 inet n - n - 10 smtpd
0.0.0.0:10030 inet n - n - 10 smtpd
-o content_filter=
-o virtual_alias_maps=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
-o mynetworks=172.17.0.0/16
-o smtpd_authorized_xforward_hosts=172.17.0.0/16
File renamed without changes.
10 changes: 10 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
docker run \
--rm \
-it \
--name mxpostfix \
--hostname mxpostfix \
--dns 172.17.42.1 \
--dns-search docker \
--volumes-from mpide_spool_1 \
mxpostfix \
bash

0 comments on commit 3200c27

Please sign in to comment.