Send mail cmd
The classic mail
command!
The mail
command is a simple way to send an email from the command line. Here's a basic syntax:
mail [-s subject] [-c carbon-copy] [-b blind-carbon-copy] [email protected]
Here's a breakdown of the options:
-s subject
: sets the subject of the email-c carbon-copy
: specifies a carbon copy recipient-b blind-carbon-copy
: specifies a blind carbon copy recipient (i.e., the recipient won't see the other recipients' addresses)[email protected]
: the email address of the recipient
Here's an example:
mail -s "Hello from the command line!" [email protected]
This will send an email with the subject "Hello from the command line!" to [email protected]
.
You can also use the -a
option to attach a file:
mail -s "Hello from the command line!" -a file.txt [email protected]
This will attach the file file.txt
to the email.
Note that the mail
command is usually configured to use a default email client, such as mutt
or mailx
. If you want to use a different email client, you can specify it using the MAILCLIENT
environment variable.
Also, keep in mind that the mail
command is a simple tool and may not support all the features you'd find in a full-fledged email client.