TQ
dev.com

Blog about software development

Subscribe

Creating 103mail.com - Update 1

12 Apr 2024 - by 'Maurits van der Schee'

I am building a free email service that respects privacy and prevents profiling on 103mail.com (see: the plan). In this post I explain how outgoing mail can be captured to be handled by a web hook, while internal email is delivered normally. The post assumes you are running Postfix as mail server and assumes you run this on a recent Debian (based) Linux server.

Make Postfix deliver to a web hook

Install postfix using

apt install postfix postfix-pcre

Choose "Internet Site" as default configuration.

nano /etc/postfix/main.cf

Add the line:

virtual_alias_maps = pcre:/etc/postfix/virtual

Add the file:

nano /etc/postfix/virtual

Content:

/.*@(?!103mail\.com$).*/ curl

Modify the file:

nano /etc/aliases 

Add the file:

curl: "|curl --data-binary @- https://103mail.com/webhook"

Optionally, add the following flags to the curl command make curl silent (except for errors):

-S -s -o /dev/null

Optionally, add the following curl option to the curl command to set the correct Content-Type header:

-H 'Content-Type: application/octet-stream'

Now make the aliases effective:

newaliases

Enable logging:

apt install rsyslog
systemctl restart postfix
tail -f /var/log/mail.log

You will see the mails and their corresponding curl calls to the web hook in the log file.

What's next?

In the next posts I will describe how to send a notification to the recipient with a web link to read the content of the mail. If you are interested, please follow this blog and also keep an eye on 103mail.com as you may be able to sign-up at a certain point in time.

Links


PS: Liked this article? Please share it on Facebook, Twitter or LinkedIn.