You would need to have sendmail and mailx packages installed.
With these, you can issue the following command to send an email via the shell:
$ echo "test" | mailx -a ./file.txt -s "subject2" abc@email.com
The above command pipes the string "test" to the mailx command which constructs an email for abc@email.com with the subject, "subject2" and an attachment, "file.txt".
Alternatively, you can enter interactive mode with the mailx command:
$ mailx -a ./file.txt -s "subject2" abc@email.com
The shell then lets you type in your message. To exit the interactive mode, you just enter a new line and type in '.'.
If sending a binary file, it's always best to encode it first:
$ uuencode file.bin file.bin | mailx -s "subject2" abc@email.com
No comments:
Post a Comment