Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-14-2008, 10:24 AM   #1
Registered: Oct 2005
Location: Switzerland
Distribution: Ubuntu
Posts: 33

Rep: Reputation: 16
Correct syntax to pipe to gpg and then mail the result...

With my email hoster I have the ability to pipe incoming emails to a program (as opposed to immediately forwarding to another address) and what I would like to do is first pipe to gpg to encrypt the mail and then mail it on to another address.

so far what I've tried is ...

## /usr/bin/gpg -ea -r -o - $1 | mail -s Test1
cat > /usr/bin/gpg -ea -r > mail -s Test1
but I don't think I've got it quite right with the piping !! (my first attempted is commented out).

(I've tried but can't get it to work)

Can anyone suggest what the correct syntax should be please?

Many tks,

P.S. I can pipe to Perl or PHP but I don't know either. If it's better to use Perl or PHP for this then I'm happy to try...but can I have some hints pls.
Old 11-14-2008, 01:51 PM   #2
Registered: Jun 2006
Location: Winnipeg, Canada
Distribution: Slackware 12.1
Posts: 33

Rep: Reputation: 16
Where's the original mail message coming from? Assuming it is being piped to this program, try this:

### the following line will send stdin to gpg, and send the output from gpg to mail
cat - | /usr/bin/gpg -ea -r | mail -s Test1


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct syntax for cu jowa45 Slackware 10 11-01-2007 09:26 AM
What is the correct syntax for chcon TexanJoe Linux - Security 1 10-19-2007 04:57 AM
What is the correct syntax for Lame darkscot Linux - Software 2 08-14-2006 01:29 AM
FC2 gpg rpm imported but apparently not correct spectrumver1 Fedora 0 03-22-2004 04:31 AM
what is the correct syntax shanenin Linux - Software 2 10-19-2003 12:31 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:07 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration