How to create an email account/address in Linux terminal?

email, linux, terminal

Solution

To answer your question, it is possible to create an email account/address via the command line on a Linux/Unix system.

The first step is to create a user account on that system for the user in question. There are different ways to do this. I found this guide, The Ultimate Guide to Create Users in Linux/Unix, to be one of the better overviews.

The next step requires understanding that email on Linux systems is often handled by two different systems/commands.

First is sending email. This is done quite often via sendmail. If a user can execute sendmail, then they can send mail via smtp to the world. This overly simplifies things, but it provides enough to get you started.

Receiving mail on the system and its delivery to users depends on the mail system and protocols being used. If you are using postfix, then the following article shows how to setup an email account.

My answer assumes you are not using LDAP or another directory service to maintain users.

This question probably belongs over in serverfault. I couldn't find an exact match to it over there, so I answered it here and flagged it to be moved.

Problem

Is it possible to create an email account under Linux* in the terminal? I've been looking to see if it is possible to generate email account dynamically for user registration purposes with my website. I've found lots of valuable resources on stack overflow and elsewhere regarding sending and receiving email, but none in regard to actually creating an account.

Original source