LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hi,
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 ...

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

(I've tried http://marc.info/?l=gnupg-devel&m=99470875105469&w=2 but can't get it to work)

Can anyone suggest what the correct syntax should be please?

Many tks,
Alex

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
teknik
Member
 
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:
Code:
#!/bin/bash

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


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:55 AM.

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