You are not logged in.

#1 2006-06-12 01:02:20

PeteMo
Member
From: H'Burg, VA
Registered: 2006-01-26
Posts: 191
Website

sending email in picasa using mutt

Hi all,

I'm trying to send emails from within picasa using mutt.  I've edited the picasa-hook-email.sh file (as seen below), made it executable, and placed it in my path. 

#!/bin/bash

#---------------------------------------------------------------------------
#   picasa-hook-email.sh
#
#   This script is passed a command line that looks like this:
#
#       <to_address>?subject=<subject>&cc=<ccs>&bcc=<bccs>&body=<body>&attach=<path>
#
#   If this script exits with a status of 0, then Picasa will
#   assume that you have handled the request, and will not perform
#   any further processing.
#
#   To use this file:
#       copy the picasa-hook-email.sh.template file to
#       some place in your path, and name it picasa-hook-email.sh.
#       Then edit the script to add the functionality you need
#
#----------------------------------------------------------------------------

#args=$1 
args='me@example.com?subject=pics&cc=&bcc=&body=here you go&attach=/home/pmorris/img/test.jpg
to=`echo $args | cut -d '?' -f1`
sub=`echo $args | cut -d '=' -f2 | cut -d '&' -f1`
cc=`echo $args | cut -d '=' -f3 | cut -d '&' -f1`
bcc=`echo $args | cut -d '=' -f4 | cut -d '&' -f1`
body=`echo $args | cut -d '=' -f5 | cut -d '&' -f1`
attach=`echo $args | cut -d '=' -f6 | cut -d '&' -f1`

urxvtc -e mutt -a $attach -c $cc -b $bcc -s "$sub" $to

This works as written, if called from the command line: A new instance of urxvt starts, running mutt, with an email started to "me@example.com, with a subject of pics, and the appropriate file attached.  The body of the email is lost, but I don't care about that.

However, when called from within picasa (uncommenting the "args=$1" line and commenting the next line), I get the following error :

Picasa was unable to execute your default email client...Please see picasa/desktop/picasa-hook-email.sh.template for instructions on how to connect Picasa to your native email client.

Has anyone successfully used picasa to send emails using a native client other than kmail or evolution?  If so, how did you manage it?

Offline

#2 2008-01-03 10:01:44

Lazer
Banned
Registered: 2007-08-02
Posts: 111

Re: sending email in picasa using mutt

I have seen it mention re other scripts htat they have to be in that /opt/picasa/... directory.  did you put it there?

I found another link with some info, may help (but mostly you prob know what's there..): http://groups.google.com/group/Google-L … a83da27a75
I can tell if his script will keep the content or not.. tata!  -@

Offline

#3 2008-01-03 10:31:52

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: sending email in picasa using mutt

you do realize you just resurrected a 1.5 year old thread ?
If you, or someone else does not have the same problem I suggest we just leave it with that

Offline

#4 2008-01-03 21:15:27

Lazer
Banned
Registered: 2007-08-02
Posts: 111

Re: sending email in picasa using mutt

Well pressh, I didn't bother to look at the date of the posting, but yes, I have the same problem, which is how I found this thread.  (This is the only googlesearch hit for "picasa-hook-email.sh mutt")

After looking at the aforementioned link's script, as well as the script provided by the original poster, I've come up with a clunky in-between solution that works.  Like the orig mutt script it doesn't take the body from picasa (with some more hacking it could).
(as you can see I didn't take the subject line or attachment filename from the link's [TB] picasa script, but from the [orig poster's] mutt scr.)

  It works simply enough though: First, as mentioned, Make sure you put it in /opt/picasa/bin.
After hitting the email button in Picasa: it'll ask you for the recipient (To: ) and then drop you into your editor of choice.  Just as you're used to!

#!/bin/bash
$LD_LIBRARY_PATH
unset LD_LIBRARY_PATH

args=$1

sub=`echo $args | cut -d '=' -f2 | cut -d '&' -f1`
attach=`echo $args | cut -d '=' -f6 | cut -d '&' -f1`

# Find the Mutt executable
MUTT=$(which mutt 2> /dev/null)
if [ -z "$MUTT" ] ; then
    exit 1
fi

ARG=$(echo "$1" | sed 's/^mailto:?//' | sed 's/%/%25/g' | sed 's/,/%2C/g')
CONTENT=$(echo "$ARG" | sed 's/\&attach=.*//' | sed 's/\&/,/g')
 #SUBJ=$(echo "$ARG" |sed 's/.*subject=/-s "/')
BODY=$(echo "$CONTENT" | sed 's/.*,cc=,bcc=,body=//')
#ATTACH=$(echo "$ARG" | sed 's/\&attach=/\n\nfile:\/\//g' | awk '/^file:/ { printf "%s",$0 }')

fileBODY=/tmp/picasa-email-content
echo $BODY > $fileBODY

NEWARG="-s $sub $(CONTENT)"
xterm -e "$MUTT" -a "$attach" "$NEWARG" #< $fileBODY

rm /tmp/picasa-email-content

exit 1

NOTE: Picasa still drops the aforementioned error after you exit mutt, not sure why..

HTH!  I'm sure I'm not the only mutt+Picasa user.  And I'm also using the newest, 2.7 (Beta) of Picasa, so this thread is officially current now. smile  tata!  -Ajay

(hm, almost feel like i should make an account on here after all this posting!)

Offline

#5 2008-01-07 10:59:34

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: sending email in picasa using mutt

Sorry I totally forgot about this post.

I actually never used picasa all that much, but as I maintain both versions of picasa in [unsupported] I will see if I can include a fix (it is not very high on my priority list so it can take some time. You can always help me out if you want to speed things up). I think I never even clicked the e-mail button, and nobody EVER mentioned it on the AUR page of the package :confused:

Offline

#6 2008-02-17 17:40:14

Lazer
Banned
Registered: 2007-08-02
Posts: 111

Re: sending email in picasa using mutt

sorry i forgot as well.  a fix is only needed if you want it to work with mutt out of the box.  And the script should probably have some cleanup beforehand as well!
maybe i could help clean it up if you could use the help and feel it would be a useful add..
But i just looked up this thread to add a nice little feature, i didn't do it in the script above, because i'm not a skilled shell scripter sad  but if you want the body to be imported to mutt, you can use:

send-hook '~s "a picture for you"' \
        'set   editor="vim '+/^$ +r/tmp/picasa-email-content'"'

On an sidenote, i also am using sed to tweak the body in the above secript.  as I upload all my pictures to flickr, i thought i'd include a link to the same img there..

BODY=$(echo "$BODY" | sed 's/\(IMG_....\)/<a href="http:\/\/www.flickr.com\/search\/?w=90417577%40N00\&q=&">\1<\/a>/')

obviously replace the 904..00 with your own flickr id, this should be easy enough for any to customize for their own uses.. (their camera and pref'd site..)  Easy and fun little hack, sorry, nothing fancy from me these days..!  smile  tata!  -@

Offline

#7 2008-02-17 19:44:16

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: sending email in picasa using mutt

Lazer wrote:

sorry i forgot as well.

yeah, thanks for remembering me wink

I'll try to look into it in the coming week. Do you mind sending me a mail so I can contact you directly to help fixing this/verifying the resulting package ?

Offline

#8 2008-10-27 02:33:16

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: sending email in picasa using mutt

Bringing the old thread back again smile  This works great, except for more than one picture, I only get the first as an attachment. According to the google groups post mentioned above, it should work with multiple attachments. Can anyone else test this? Picasa problem or Mutt problem?

Thanks!
Scott

Offline

#9 2008-10-30 20:13:51

PeteMo
Member
From: H'Burg, VA
Registered: 2006-01-26
Posts: 191
Website

Re: sending email in picasa using mutt

Here is the script I'm currently using that works with multiple photos:

#!/bin/bash
#
# Picasa calls this with one argument:
# <to_address>?subject=<subject>&cc=<ccs>&bcc=<bccs>&body=<body
# text>&attach=<path to attachments>

shell=urxvtc
attach_path=$(dirname "$(echo $1 | awk -F "&attach=" '{print $2}')")
cd "$attach_path" && $shell -e mutt -a *.jpg --

Change $shell to whatever you use.

Offline

#10 2008-11-01 05:51:43

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: sending email in picasa using mutt

Thanks PeteMo! That works great. Well, works with xterm, but sakura has some problems with the -e command. Things have to be quoted different than xterm, and sometimes it just doesn't work.....like with this one. But I can live with xterm for the few times I use Picasa to email my pix!

Thanks!
Scott

Offline

#11 2009-01-17 18:45:37

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: sending email in picasa using mutt

[SOLVED]

Hmmmm, I haven't used this since picasa upgraded to 3.0 .... now it doesn't work anymore. Anyone have a working picasa-hook-email.sh for Picasa 3.0? It just flashes the terminal but doesn't keep it open.

Edit: Tried the script by Lazer, and it functions, but only attaches the first picture if multiple pictures are selected. And it also opens a blank firefox tab for no apparent reason that I can see? Fixes for multiple pictures?

Edit2: Ok, using PeteMo's script, figured out that Picasa is now using uppercase for the file extension -- changed .jpg to .JPG in the script and it works great again.

Thanks,
Scott

Last edited by firecat53 (2009-01-21 22:58:36)

Offline

Board footer

Powered by FluxBB