To send an email with attachments from the command line on a FreeBSD system, you can use the mutt
command-line email client. Mutt is a powerful and flexible email client that allows you to send emails from the command line with various options and features, including the ability to attach files to your emails.
To send an email with attachments using mutt
, follow these steps:
mutt
on your system if it is not already installed. You can install it using the pkg
package manager:# pkg install mutt
vi
or nano
. For example:vi email.txt
Type the body of your email in the file. When you are finished, save the file and exit the text editor.
Use the mutt
command to send the email, specifying the email address of the recipient and the path to the file containing the body of the email as arguments. You can also specify the -a
option followed by the path to the file you want to attach to the email:
mutt -a /path/to/attachment.pdf recipient@example.com < email.txt
This will send an email to recipient@example.com
with the contents of email.txt
as the body of the email, and attachment.pdf
attached to the email.
You can also specify multiple attachments by using the -a
option multiple times:
mutt -a /path/to/attachment1.pdf -a /path/to/attachment2.pdf recipient@example.com < email.txt
For more advanced usage, you can specify the -s
option followed by a subject for the email and the -cc
and -bcc
options to specify additional recipients. You can also use the mutt
command with a configuration file to set various options and preferences.
For more information about using mutt
to send emails from the command line, you can refer to the mutt
man page by running man mutt
on the command line, or consult the Mutt documentation online.