xdg-email
Open an email composer with specified information
SYNOPSIS
xdg-email [--utf8] [--cc address] [--bcc address] [--subject subject] [--body text] [--attach file] [recipient]
PARAMETERS
recipient
The email address of the primary recipient.--cc address
Adds a carbon copy recipient to the email.--bcc address
Adds a blind carbon copy recipient to the email.--subject subject
Sets the subject of the email.--body text
Sets the body of the email.
The text should be URI-encoded if it contains special characters.--attach file
Attaches the specified file to the email.--utf8
Interpret command line parameters as UTF-8. This option is enabled by default.
DESCRIPTION
The xdg-email
command is a command-line utility designed to invoke the user's preferred email composer. It provides a standardized way for scripts and applications to compose and send emails without needing to know the specific email client being used. The command handles various options to specify the recipient, subject, body, and even attachments for the email. It relies on the XDG (Cross-Desktop Group) Base Directory Specification to determine the appropriate email client and its associated command-line arguments. xdg-email
ensures that the email is composed and opened using the user's chosen email application, promoting a consistent user experience across different desktop environments and email clients. It simplifies email integration for shell scripts, GUI applications, and other programs that need to send emails programmatically. It provides a layer of abstraction, shielding applications from the complexities of different email client configurations. It effectively handles the differences in how various email clients handle command-line arguments for composing messages.
CAVEATS
The behavior of xdg-email
depends on the user's desktop environment and configured default email client. The available options and their interpretation might vary between different email clients. URI encoding of the body can be tricky.
ENCODING CONSIDERATIONS
The --body
parameter requires careful handling of special characters. It is often necessary to URI-encode the text to ensure that it is correctly interpreted by the email client. For instance, spaces should be encoded as %20
. The --utf8
parameter defines the charset of the subject and body.
ALTERNATIVES
Many email clients provide their own command-line interface or APIs, such as sendmail
, mutt
, or email client specific tooling. These tools offer more detailed and custom control, but are less portable than xdg-email
.
HISTORY
The xdg-email
command is part of the XDG utilities, which were developed to provide a set of standardized tools for desktop integration across different Linux distributions and desktop environments. It aims to abstract away the specific details of each environment, allowing applications to interact with the system in a consistent manner. The command emerged as a solution to the problem of varying email client command-line interfaces. It provides a common interface for sending emails, regardless of the underlying email client. It is now a standard component on most Linux distributions, supporting a wide range of desktop environments.
SEE ALSO
xdg-open(1), xdg-settings(1)