FAQ about patches | More patches | Main Page | MD5 sum for this patch

Alpine sends e-mail from the command line
Patch is available for versions: alpine 1.00 alpine 1.10 alpine 2.00 alpine 2.01 alpine 2.10 alpine 2.11 alpine 2.20 alpine 2.21

Once you have succesfuly applied and compiled the patch, you can send a message through the command line as follows:
alpine -I ^X,y -subject "this is a subject" foo1@bar1.com foo2@bar2.com < input_file
(notice that the first switch is the capital letter I, not the pipe command |, I apologize if this causes you any confusion) This will allow you to send input_file to foo1 and foo2. I could send a message from a script, just enclosing ^X,y in quotes. Please read the note below.
Note that depending on the operative system that you are using you may want to enclose the ^X,y part of the command in quotes (like "^X,y" or '^X,y'), if you receive an error saying that the -I option did not have any arguments. Also if you are planning to use this patch in conjunction with a cron job and these suggestions do not work for you, you may want to read some extra suggestions sent to me by Darrel Woodard.
You can also use the -attach option with this command. I recommend to alias the part alpine -I ^X,y to be another command, to abbreviate the command.
You can also use your roles when sending from the command line, for doing this you need to use the command:
alpine -I #,^M,^X,y -subject "this is a subject" person@domain.com < file
You can use your second role by writting -I #,n,^M,^X,y, your third role by using the command -I #,n,n,^M,^X,y etc.
Note that Alpine will not confirm the role that you will use when sending a message even if you have set it to use with confirmation, in that way we reduce prompting when sending. If you want to use a specific role, use the method of sending it as described above (#,n,n etc).
If you want to attach a file you can use the ^J command to attach a message. Although you can do this from the command line with the -attach switch, you can also use this method to add a comment to the attachment, for example the command
alpine -I ^J,\"file\",^M,\""Sample Comment"\",^M,^X,y foo@bar.com
worked in my Linux machine to send a message with attachments from the command line. Thanks to Paulus Raimund for the suggestion and testing a version of this patch.
Another interesting thing you can do is to add Cc:, Bcc:, or any header with any value. For example, you can try adding
-customized-hdrs='Cc: "person@some.place,another@somewhere.else",Other-Header: "Here is the value"'
As you can see, different headers are separated by commas
while their values are enclosed in double quotes
The full value is enclosed between single quotes
'Cc:...is the value"'.
Since this is done in the command line, the correct way to do this may depend on your shell. The above way works in the tcsh shell.

This patch was featured in the issue #20 of the E-Zine Magazine.

Last Updated 16:15:23 MST Sun Feb 05 2017.