Newmail: Generating random email aliases on OpenSMPTD
source link: https://www.tuicool.com/articles/hit/7ZBfQvI
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
newmail
is a simple script to generate random e-mail aliases from the command line for OpenSMTP on OpenBSD. I wrote this to avoid having to give out my real e-mail address to every place which requires registration.
whichemail
queries the aliases for previously generated e-mails.
Usage
To get a new e-mail address, you simply run newmail
, with an optional argument identifying the site you associate with this address:
[email protected]$ newmail hub.darcs.net [email protected]
And if you later forgot which one you had generated:
[email protected]$ whichmail hub.darcs.net [email protected]
How does it work?
After running newmail
, the following lines have been added to /etc/mail/aliases
:
# f5cb7a763186dea37d3f98f7ce9bae6a9449587892acd69f89f88bcae71e694f pemovrypur: user
whichmail user
Requirements
- A working mail server.
-
apg
, for reasonable looking random addresses, available as a package as an OpenBSD package . -
rc
andssam
from plan9port also an OpenBSD package.
Installation
Download and copy the above scripts to
/usr/local/bin/newmail /usr/local/bin/whichmail
Edit the configuration variables at the top of the script. Remember to read through the source files to understand what they do. Then consider applying a few conveniences to your system configuration.
The following line in /etc/doas.conf
enables usersto run it:
permit nopass :users as root cmd newmail
For ease of use, I also added the following to /etc/skel/.profile
and current users $HOME/.profile
:
alias newmail='doas newmail'
Source
The scripts are written in rc
(the shell of Plan9port
). You can easily port them to any other shell your self. The newmail
script itself is roughly ten lines.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK