EMAIL(1)

πŸ“¦
version 3.1.4 Β· 2 versions
, in alpine 3.22, alpine 3.23, alpine 3.24

πŸ’Œ NAME πŸ’Œ

okay bestie, we're looking at EMAIL(1) from the General Commands Manual, and the command's name is email β€” short for Encrypted SMTP email via Command line. She's giving terminal-girlie with a GPG keychain, and we're obsessed. This is part 1 of 2, so buckle up and don't touch that scrollback.

✨ SYNOPSIS ✨

email [options] recipient1,recipient2,recipient3,...

πŸ¦‹ DESCRIPTION πŸ¦‹

email is a command line email client, similar to mailx, but with extra sparkle. The added features make it a more advanced client for sending email via the command line. It works with sendmail, just like mailx does β€” but email also lets you send to remote SMTP servers for delivery. It also works with GPG for encrypting and signing emails on the fly. Iconic, honestly.

email also incorporates a few other features too. These include signature files with wildcard options to specify the data, time, day, version, system, and even a fortune with the help of the fortune command. email also supports a very configurable address book, so you can specify a person's name with an email address and also place a group of names into one group for sending.

email supports attachments too. It will accept N attachments via a command line option and encode them with Base64 before sending them with the email.

email works with a configuration file named email.conf, which is found in /etc/email/email.conf β€” although that can be changed by specifying the --sysconfdir option during the ./configure. If you don't have or don't want a configuration file, you can specify the -r option to specify your SMTP server, and that will let you bypass using a configuration file and use default values instead. If you specify the -r option (listed below) and you do have a configuration file, it will still use the configuration file but override the SMTP_SERVER variable with whatever is used at the command line. Slay.

πŸ’… OPTIONS πŸ’…

There are a few possible options for email. The original lists them in order of relevance of usage, so we're keeping that exact order, bestie.

  • --help module, -h Module of Help β€” This option can be specified with a module of help topic, or without one. Without a module of help topic, it will just print a standard help screen with all your possible options. With a module of help option, it will display a more detailed discription of that module. Modules are determined by command line switches. For instance: if you want to know about the encrypt command line option, you would specify --help 'encrypt' or --help 'e', and help will display the correct module help section. The Help is not statically programmed into email. Instead it is a file in email's home directory β€” the original says β€œcalled be rewritten with every release of email,” and yes, that's the actual wording, no cap β€” and it gets rewritten with every release of email.
  • --verbose, -V β€” This option will display the progress of communicating with the SMTP server. A pretty progress bar will be displayed when data is sent. This option is replacing the old -quiet option that would do the exact opposite.
  • --blank-mail, -blank-mail, -b β€” Use this option if you would like to send a blank email from the command line. This is good if you just want to send a message with only the headers and no content.
  • --subject subject, -subject subject, -s Subject of Email β€” This option should be rather obvious. You specify the subject of the email with this option. If you are not redirecting to standard input and you do not specify a subject, email will ask you for the subject. Null subjects are allowed.
  • --encrypt, -encrypt, -e β€” This option allows you to encrypt your email message using gpg. GPG can be obtained by going to: (the original page just leaves that hanging, bestie β€” I'm not inventing a URL). When this option is specified, it will get the first recipient from the recipient list and it will encrypt the message using their key. This key MUST be present in order for the encryption to work properly.
🚨 no key, no encryption, no vibes β€” the key MUST be present, periodt.
  • --sign, -sign β€” This option will let you sign your emails on the fly... It uses the gpg --detach-sign option. It will sign the email with your public key.
  • --cc recipient, -cc recipient1,recipient2,recipient3,... β€” This option allows you to β€œcurtosy copy” a list of recipients. Recipients can be from the address book or just plain email addresses. They should be comma delimited just as the main recipients will be. CC recipients will be posted in the headers and read by email clients.
  • --bcc receipient, -bcc recipient1,recipient2,recipient3,... β€” Same as the --cc option, but these recipients will not be posted in the headers of the email. This is a positive solution to β€œsecretly” copy someone on the email without the other recipients knowing so (Managers usually bcc their boss when sending an email to you about your performance and you'll never know it ).
πŸ™ˆ the --bcc receipient spelling is literally what the original says β€” I am not fixing her, I am respecting her.
  • --attach file, -a file β€” Attach a binary file. This option will allow you to attach N files to your email and will be base64 encoded upon delivery. This option is helpful if you need to send any type of file that is not plain ascii text. This option can be used multiple times to add multiple files to attach.
  • --smtp-server server, -r server β€” This option will let you override the SMTP server that is specified in the email.conf file... You can use this option if you do not have an email.conf file. It will allow you to use email without a configuration file. A helpful option to add with this option would be the --smtp-port option, however, it is not needed.
  • --smtp-port port, -p port β€” This option works well with the above option as it will allow you to bypass the configuration file and specify a port on the command line. This is helpful if you don't have a configuration file yet need to specify an SMTP server and a port. The default port is always port 25, so that if you don't specify this option, and you don't have an email.conf file, it will default to port 25 for you.
  • --smtp-auth type, -m type β€” You must specify this option to use SMTP AUTH if you aren't using a configuration file. type is the type of AUTH your server lets you use. There are two supported AUTH types with email: PLAIN and LOGIN.
  • --smtp-user user, -u user β€” If you don't want to keep your SMTP username in your email.conf file (SMTP_AUTH_USER), then you can use this command line option to specify it.
  • --smtp-pass pass, -i pass β€” If you don't want to keep your SMTP password in your email.conf file (SMTP_AUTH_PASS), then you can use this command line option to specify it.
  • --from-name name, -n name β€” This option will override MY_NAME in email.conf. This is what the recipient will see in the from field of their email client.
  • --from-addr addr, -f addr β€” This option will override MY_EMAIL in email.conf. This is what the recipient will see in the from field of their email client as your email address.
  • --conf-file file β€” Use this option to specify a configuration file other than ~/.email.conf or /etc/email/email.conf.
  • --header string, -H string,string,string,... β€” If you would like to append headers to the message that you are sending, you can use this option multiple times and specify the header you would like to append as well as delimit each header string with a comma for multiple headers. An example of a header string would look like:
--header "X-My-Header: Stuff goes here"
  • --timeout secs, -x secs β€” Set a timeout (in seconds) on the socket. This is helpful if you would like to have the client stop trying to send/recv data from the SMTP server if it hangs after a period of time.
  • --high-priority, -o β€” This option allows you to take advantage of using the priority option used by some email clients. If the option is specified when sent to a user using MS Outlook, a small exclimation mark will be next to the message as to let the user know this email is important.
  • --html β€” This option allows you to send HTML emails. As of right now, you need to write your own HTML.
  • --gpg-pass , -g pass β€” If you don't want to keep your GPG password in your email.conf file (GPG_PASS), then you can use this command line option to specify it.
  • --tls β€” If you'd like to use TLS/SSL communication with the SMTP server, use this option (if it's not already set in the config file).
  • --no-encoding β€” If you don't want eMail to automatically use UTF-8 encoding when finding non ascii characters, use this option.

πŸ’– CONFIGURATION πŸ’–

okay so configuring email is actually pretty simple, bestie. Just open the default configuration file. If you didn’t specify an email home directory when you compiled email, then it’ll be in /etc/email and the file is called email.conf. The config options are all listed below, no cap:

  • SMTP_SERVER β€” server name, or IP
  • SMTP_PORT β€” server’s port number
  • SENDMAIL_BIN β€” specify the sendmail binary path and options
  • MY_NAME β€” specify your name
  • MY_EMAIL β€” specify your email address
  • REPLY_TO β€” separate reply-to address
  • SIGNATURE_FILE β€” your signature file
  • SIGNATURE_DIVIDE β€” a design for a divider
  • ADDRESS_BOOK β€” location of your address book file
  • SAVE_SENT_MAIL β€” directory to save email.sent file
  • GPG_BIN β€” full path to gpg binary
  • GPG_PASS β€” optional passphrase for gpg
  • TEMP_DIR β€” specify where to store temp files
  • SMTP_AUTH β€” specify what type of authentication for your SMTP server
  • SMTP_AUTH_USER β€” specify a username login for SMTP AUTH
  • SMTP_AUTH_PASS β€” specify a password for SMTP AUTH
  • USE_TLS β€” Boolean (true/false) if you want to use TLS/SSL
  • VCARD β€” specify a vcard to attach to each message

You can choose to use sendmail instead of a remote SMTP server. All you have to do is input the path of where you have sendmail located in the SENDMAIL_BIN variable. You may also provide options to pass sendmail. The best values for this would be /usr/lib/sendmail -t -i. If you have both SENDMAIL_BIN and SMTP_SERVER uncommented and both have values, then SMTP_SERVER will take precedence over SENDMAIL_BIN and email will try to contact the SMTP server provided. πŸ’…

You can create your own email.conf file in your home directory. It must be a hidden file. For instance: ~/.email.conf

email will look in your home directory before it looks for a global configuration file. The easiest thing to do is simply copy your global config file to your home directory as .email.conf and edit it as needed. 🫢

If you don’t have a global config file or a personal config file, email will choose defaults according to your current login on the system. So a configuration file is not mandatory β€” it just helps you customize email. ✨

You can look at the basic configuration file for more information on the configuration of email.


πŸ” SMTP AUTH πŸ”

email now supports SMTP AUTH. I’ll briefly describe how it works here, bestie.

To use email with an SMTP server that expects authentication, you must set a few options in your email.conf file. These options are: SMTP_AUTH, SMTP_AUTH_USER, SMTP_AUTH_PASS.

SMTP_AUTH

This option must be set to one of the two: LOGIN or PLAIN. LOGIN and PLAIN are standard RFC compliant SMTP AUTH protocols. If you’re unsure which option to choose, ask your ISP or SMTP Administrator if any of these are supported. Usually it’s a safe bet to use LOGIN for SMTP AUTH. Most AUTH servers support LOGIN. πŸ‘‘

SMTP_AUTH_USER

If you’re using SMTP AUTH, please specify your username here. This option is mandatory if you’re using SMTP AUTH. no skipping it, fr fr.

SMTP_AUTH_PASS

You can choose to set this option or not. However, if you don’t set this option, email will prompt you for your password before proceeding. So if you’re using email from a cron job and don’t expect any interaction with email, please set this option! 😭

USE_TLS

This option allows you to use TLS/SSL to communicate with your SMTP server. This is the most basic use of TLS/SSL possible. Please be advised that not much is done to verify the certificate from the server. Also, currently there is no support for providing your own certificate for the server to authenticate since typical TLS does not do this.

🫢 lowkey important caveat: the TLS/SSL support here is basic. It does not do much certificate verification, and you can’t provide your own certificate for the server to authenticate β€” typical TLS doesn’t do that anyway.

🌸 ENVIRONMENT VARIABLES 🌸

Two environment variables can be set that email will check.

EDITOR will allow you to specify your favorite editor to use with email for constructing messages. If this variable is not set, it will default to vi. ✨

TMPDIR can be set to specify a temporary directory to place your temp files while email is working. This is analogous to the TEMP_DIR variable in email.conf. environment variable TMPDIR for a temporary directory. If neither contains a value, email defaults to /tmp. πŸŽ€


πŸ¦‹ ADDRESS BOOK πŸ¦‹

The address book for email takes on the format as described below. It will check for any syntax errors in the address book and completely stop email if it finds any, so try to keep the same grammatical syntax. A single entry in the address book will look like:

single: Tim = tim@somedomain.org   #Comments allowed

You are welcome to use a whole name with spaces as long as you use a single quote closing the name with another single quote. You may also use double quotes in place of the single quotes. Example:

single: 'Tim Gahan' = tim@somedomain.org

Groups are allowed and can only consist of comma delimited single entries from the file and may contain spaces. You can not recursively specify groups. You may, however, specify single email addresses that are not part of the address book. πŸ’…

If you would like to break one line into two lines, you should use the \ as a newline escape mark. Examples:

group: Mygroup = 'Tim Gahan', John, Sam, Bob, \
                    tookie@somedomain.org

This example will specify a group with the single entries of 'Dean Jones', John, Sam, Bob, and the unadded email address of 'software@somedomain.org'. 😭 yes, that’s exactly what the page says β€” keep the vibes, keep the details.


πŸŽ€ SIGNATURE FILE πŸŽ€

The signature file is specified in the configuration file. You will also have the option to specify a signature divider. This is by default '---'. This just divides the signature file from the rest of the email. ✨

There are a few wild cards that you can specify in writing your signature file that will allow your signature file to obtain dynamic options when sending your email.

  • %v β€” this will show the version of email
  • %t β€” this will show the time the email was sent
  • %d β€” this will display the date the email was sent
  • %c β€” this will display a completely formatted date and time
  • %h β€” this will display the host type
  • %f β€” this will display the output of the fortune command

🌈 SIGNATURE EXAMPLE 🌈

Example of a signature file is below:

This email was sent with 'email %v'
Sent on host: %h
At the time : %c
Your fortune for today is:
%f

This will end up replacing the %v, %h, %c, and %f with their corresponding equivalents above respectively. slay. πŸ’–


πŸ”₯ EXAMPLES OF USAGE πŸ”₯

# Redirect your message to email
email -s "Sending this.txt" tim@somedomain.org < this.txt

# Make your message with email
email -s "Subject" tim@somedomain.org

# Encrypt and email to "Dean Jones"
email -s "Encryted" -encrypt tim@somedomain.org

# Multiple Recipients from address book
email -s "no subject" Dean,Jeff,Tom,Bob -cc Josh,Carl

# Attach some files with your message
email -s "files attached" Dean,Jeff --attach
stuff.tar.gz,readme.doc

πŸ’€ BUGS πŸ’€

If you find any in this program, please submit them to

http://www.cleancode.org/projects/email/contact


πŸ‘‘ AUTHORS πŸ‘‘

Dean Jones β€” http://www.cleancode.org/projects/email/contact


🌈 THANKS FOR RELEASE V3.0 🌈

Philip Lewis β€” helped in debugging. 🫢


(C) 2001 - 2008


πŸ’– and that’s a wrap on EMAIL(1), bestie β€” source/version vibes are EMAIL(1) / release V3.0, date vibes are (C) 2001 - 2008. periodt. πŸŽ€

πŸ“¦ where this page comes from