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 snapshot alpine 0.83 alpine 0.98 alpine 0.99 alpine 0.999 alpine 0.9999 alpine 0.99999 alpine 0.999999 alpine 1.99 alpine 1.999 alpine 2.19.4 alpine 2.19.5 alpine 2.19.6 alpine 2.19.7 alpine 2.19.99 alpine 2.20.1 alpine 2.20.3 alpine 2.20.4 alpine 2.20.5 alpine 2.20.6 alpine 2.20.7 alpine 2.20.8 alpine 2.20.9 alpine 2.20.11 alpine 2.20.12 alpine 2.20.13 alpine 2.20.14 alpine 2.20.15 alpine 2.20.16 alpine 2.20.17 alpine 2.20.99 alpine 2.20.999

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
...else",Other-Hea...",
while their values are enclosed in double quotes
..."person@some...somewhere.else"...
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 13:10:23 MST Sun Jan 01 2017.