How to send and receive emails with OpenSMTPDShare on Twitter
That means that all emails sent to root are going to YOUR_LOCAL_USER.
If you want you can add some other aliases, like “contact” or “hi”.
After we add all our aliases it’s necessary to run
newaliases /etc/mail/aliases: 70 aliases
Now you should create an SSL certificate like here or use an existing one.
Now we can populate
/etc/mail/smtpd.conf and replace example.com with your domain.
Everything we want is to receive emails from other for local users and deliver
all emails to users mbox => /var/mail/YOUR_LOCAL_USER
table aliases file:/etc/mail/aliases pki example.com key "/path/to/your/example.com.key" pki example.com certificate "/path/to/your/exmaple.com.crt" listen on egress tls pki exmaple.com listen on egress port 587 hostname example.com tls-require pki example.com auth mask-source accept from any for domain "example.com" alias <aliases> deliver to mbox accept from any for local alias <aliases> deliver to mbox accept from local for any relay
That’s it. OpenSMTPD is listen on port 25 and 587 and accept encrypted connections. The key and certificate location are configured with the pki keyword. And the messages are delivered to system mbox of the user (/var/mail/YOUR_LOCAL_USER).
/etc/mail/mailname with your domain.
Now you can check you configuration
smtpd -n and when everything looks ok,
you can restart OpenSMTPD
rcctl restart smtpd
Check your OpenSMTPD server with telnet
EHLO exmaple.com MAIL FROM: <email@example.com> RCPT TO: <firstname.lastname@example.org> DATA Subject: This is just a test <- blank line -> This is a test :) <- blank line -> . QUIT
If it’s says something like
250 2.0.0: 574eff74 Message accepted for delivery,
congratulation OpenSMTPD works.
Have something to say?
Ping me on Twitter. That way your thoughts aren't lost forever on this site.