Mutt -- Shellscript

This is a discussion on Mutt -- Shellscript within the Mutt forums in Other Technologies category; Hello Is there a better or easier way to send an gpg-encrypted e-mail with mutt and a shellscript? This solution works with an attached gpg-encrypted file. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ #!/bin/sh path=$(/bin/pwd) mail=$(echo "Hello\n\nGreetings") echo 'That is a test.' > "$path"/text.txt gpg -e -r 'User' "$path"/text.txt echo "$mail" | mutt -s 'Test' -a "text.txt.gpg" 'test @ test.com' rm text.* exit 0 ################################################## ############ But I'd like to have a shellscript for sending gpg-encrypted e-mails with mutt without an attachment. I tested the... set pgp_autoencrypt=yes ....option in the ~/.muttrc, but it didn't work... Thanx for your help. Daniel Baumann...

Go Back   Application Development Forum > Other Technologies > Mutt

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-30-2007, 11:52 AM
Daniel Baumann
Guest
 
Default Mutt -- Shellscript

Hello

Is there a better or easier way to send an gpg-encrypted e-mail
with mutt and a shellscript?

This solution works with an attached gpg-encrypted file.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~

#!/bin/sh

path=$(/bin/pwd)

mail=$(echo "Hello\n\nGreetings")

echo 'That is a test.' > "$path"/text.txt

gpg -e -r 'User' "$path"/text.txt

echo "$mail" | mutt -s 'Test' -a "text.txt.gpg" 'test@test.com'

rm text.*

exit 0

################################################## ############

But I'd like to have a shellscript for sending gpg-encrypted
e-mails with mutt without an attachment. I tested the...

set pgp_autoencrypt=yes

....option in the ~/.muttrc, but it didn't work...

Thanx for your help.
Daniel Baumann
Reply With Quote
  #2  
Old 09-30-2007, 12:56 PM
Daniel Baumann
Guest
 
Default Re: Mutt -- Shellscript

Hello again

> Daniel Baumann wrote:
>
> Hello
>
> Is there a better or easier way to send an gpg-encrypted e-mail
> with mutt and a shellscript?
>
> This solution works with an attached gpg-encrypted file.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
>
> #!/bin/sh
>
> path=$(/bin/pwd)
>
> mail=$(echo "Hello\n\nGreetings")
>
> echo 'That is a test.' > "$path"/text.txt
>
> gpg -e -r 'User' "$path"/text.txt
>
> echo "$mail" | mutt -s 'Test' -a "text.txt.gpg" 'test@test.com'
>
> rm text.*
>
> exit 0
>
> ################################################## ############
>
> But I'd like to have a shellscript for sending gpg-encrypted
> e-mails with mutt without an attachment. I tested the...
>
> set pgp_autoencrypt=yes
>
> ...option in the ~/.muttrc, but it didn't work...


I found and tested this solution and it is working now very well:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

#!/bin/sh

path=$(/bin/pwd)

echo 'That is a test.' > "$path"/text.txt

gpg -e -a -o mail.txt -r 'User' "$path"/text.txt

mail=$(cat mail.txt)

echo "$mail" | mutt -s 'Test xy' 'test@test.com'

rm text.txt mail.txt

exit 0

################################################## ############

With the "-a option" in the line...

gpg -e -a -o mail.txt -r 'User' text.txt

....it is possible to create ASCII armored output and the "-o
option" writes the output to a file.

The result in the e-mail looks now like...

halifax@laptop:~$ cat mail.txt
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.6 (GNU/Linux)

hQIOA9B7OutKGxTJEAgAtQ0/raSb5dcZs+rKaRM00/S+lPGLDmxZzNpMAShO68+8
BZbqY3GJjho+PvA0mtpWyYFLcwuVNl2cqIYXKTpTdOtxoLT2TA gR90xz10I5ddmo
fKgQ3dnV7VTzwqRHhI8hREN4Pamyva5O2b85yO1iTQMxe4AKjZ 4k2+OkBx6CLo8C
S6ubwAa5mKkU2aYEI0x+N20/j7x8GJGJ5omaCcElyOH6lVrm4NyIjAapQ8Q1gUwq
lc+vNp/eULWCx47jTWd4goqrF3szsBmGWUnJhIIJaBsKnENah1iENjzc3 tGUYtDT
gEgZOGs1pHhzJrqXvywguzgx/RzGBp0T0oalYGOEHggAwHnz2IABSwojnbPLtE1O
Zt47VDygj1uXtDbX9ZimvMABtYs60NGTFwPCzYLHXszUmlzjuI hOJ0grz09qPe+t
aUTIrw4HFUtPF8JA+bN6Lss7ao7rZrLzIrdt/vhgdWI0l0opSLqgTcSbyMlxXep9
U1J53l03pH8L8k463HZ3vmPdU0qNVWmLbzSYpzq4tE/B1CMUsw5LiEImZsIxQ3VJ
pQTF5iV/MAuLX183jXj8CiI3xBCU9k0RPnQS2jDAj0bLsOeuNm2pfKt4s4 NZZPID
sGp973rGhW1uxz25DS7JmqXDKm9OB5xTRGL1QjB3NMlob+Wux0 C1YT6fPnZKIX1k
E9JzAXKo0zSbyOREZU1YtwObvgVHbn7loDua/Xdi2u27l/UDOhxQtzgh92PgVn3k
vE6juq7cvLNjxu3ziTYJ8ne451OKKNtQ8Q93DKueDp6rE1OaVd uT32d8mCfNLvC6
JEXsZOm1ELGdxNlfCsCaxDupXprppQ==
=hpZO
-----END PGP MESSAGE-----
halifax@laptop:~$

....and that's it what I want. ;-)

Greetings
Daniel Baumann
Reply With Quote
  #3  
Old 09-30-2007, 01:17 PM
Daniel Baumann
Guest
 
Default Re: Mutt -- Shellscript

Hello again

> Daniel Baumann wrote:
>
> Hello
>
> Is there a better or easier way to send an gpg-encrypted e-mail
> with mutt and a shellscript?
>
> This solution works with an attached gpg-encrypted file.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
>
> #!/bin/sh
>
> path=$(/bin/pwd)
>
> mail=$(echo "Hello\n\nGreetings")
>
> echo 'That is a test.' > "$path"/text.txt
>
> gpg -e -r 'User' "$path"/text.txt
>
> echo "$mail" | mutt -s 'Test' -a "text.txt.gpg" 'test@test.com'
>
> rm text.*
>
> exit 0
>
> ################################################## ############
>
> But I'd like to have a shellscript for sending gpg-encrypted
> e-mails with mutt without an attachment. I tested the...
>
> set pgp_autoencrypt=yes
>
> ...option in the ~/.muttrc, but it didn't work...


I found and tested this solution and it is working now very well:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

#!/bin/sh

path=$(/bin/pwd)

echo 'That is a test.' > "$path"/text.txt

gpg -e -a -o mail.txt -r 'User' "$path"/text.txt

mail=$(cat mail.txt)

echo "$mail" | mutt -s 'Test xy' 'test@test.com'

rm text.txt mail.txt

exit 0

################################################## ############

With the "-a option" in the line...

gpg -e -a -o mail.txt -r 'User' text.txt

....it is possible to create ASCII armored output and the "-o
option" writes the output to a file.

The result in the e-mail looks now like...

$ cat mail.txt
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.6 (GNU/Linux)

blablabla...
-----END PGP MESSAGE-----
halifax@laptop:~$

....and that's it what I want. ;-)

Greetings
Daniel Baumann
Reply With Quote
  #4  
Old 09-30-2007, 01:19 PM
Daniel Baumann
Guest
 
Default Re: Mutt -- Shellscript

Hello again

> Daniel Baumann wrote:
>
> Hello
>
> Is there a better or easier way to send an gpg-encrypted e-mail
> with mutt and a shellscript?
>
> This solution works with an attached gpg-encrypted file.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
>
> #!/bin/sh
>
> path=$(/bin/pwd)
>
> mail=$(echo "Hello\n\nGreetings")
>
> echo 'That is a test.' > "$path"/text.txt
>
> gpg -e -r 'User' "$path"/text.txt
>
> echo "$mail" | mutt -s 'Test' -a "text.txt.gpg" 'test@test.com'
>
> rm text.*
>
> exit 0
>
> ################################################## ############
>
> But I'd like to have a shellscript for sending gpg-encrypted
> e-mails with mutt without an attachment. I tested the...
>
> set pgp_autoencrypt=yes
>
> ...option in the ~/.muttrc, but it didn't work...


I found and tested this solution and it is working now very well:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

#!/bin/sh

path=$(/bin/pwd)

echo 'That is a test.' > "$path"/text.txt

gpg -e -a -o mail.txt -r 'User' "$path"/text.txt

mail=$(cat mail.txt)

echo "$mail" | mutt -s 'Test xy' 'test@test.com'

rm text.txt mail.txt

exit 0

################################################## ############

With the "-a option" in the line...

gpg -e -a -o mail.txt -r 'User' text.txt

....it is possible to create ASCII armored output and the "-o
option" writes the output to a file.

The result in the e-mail looks now like...

$ cat mail.txt
#-----BEGIN PGP MESSAGE-----
#Version: GnuPG v1.4.6 (GNU/Linux)

#blablabla...
#-----END PGP MESSAGE-----
halifax@laptop:~$

....and that's it what I want. ;-)

Greetings
Daniel Baumann
Reply With Quote
  #5  
Old 09-30-2007, 01:22 PM
Daniel Baumann
Guest
 
Default Re: Mutt -- Shellscript

Hello again

> Daniel Baumann wrote:
>
> Hello
>
> Is there a better or easier way to send an gpg-encrypted e-mail
> with mutt and a shellscript?
>
> This solution works with an attached gpg-encrypted file.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
>
> #!/bin/sh
>
> path=$(/bin/pwd)
>
> mail=$(echo "Hello\n\nGreetings")
>
> echo 'That is a test.' > "$path"/text.txt
>
> gpg -e -r 'User' "$path"/text.txt
>
> echo "$mail" | mutt -s 'Test' -a "text.txt.gpg" 'test@test.com'
>
> rm text.*
>
> exit 0
>
> ################################################## ############
>
> But I'd like to have a shellscript for sending gpg-encrypted
> e-mails with mutt without an attachment. I tested the...
>
> set pgp_autoencrypt=yes
>
> ...option in the ~/.muttrc, but it didn't work...


I found and tested this solution and it is working now very well:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

#!/bin/sh

path=$(/bin/pwd)

echo 'That is a test.' > "$path"/text.txt

gpg -e -a -o mail.txt -r 'User' "$path"/text.txt

mail=$(cat mail.txt)

echo "$mail" | mutt -s 'Test xy' 'test@test.com'

rm text.txt mail.txt

exit 0

################################################## ############

With the "-a option" in the line...

gpg -e -a -o mail.txt -r 'User' text.txt

....it is possible to create ASCII armored output and the "-o
option" writes the output to a file.

The result in the e-mail looks now like...

$ cat mail.txt
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.6 (GNU/Linux)
blablabla...

....and that's it what I want. ;-)

Greetings
Daniel Baumann
Reply With Quote
Reply


Thread Tools
Display Modes


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


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.