Re: Adding entries to ldap addressbook
- To: mutt-users@xxxxxxxx
- Subject: Re: Adding entries to ldap addressbook
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Wed, 27 Feb 2008 15:03:14 -0600
- Comment: DomainKeys? See http://domainkeys.sourceforge.net/
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=memoryhole.net; h=date: from:to:subject:message-id:references:mime-version:content-type: in-reply-to; q=dns/txt; s=default; bh=pk90pFIAESVC7yOrCd8PQfG9zD 8=; b=aT56hdjrTGLGWC02jJ7/HaupQ5azHZW1Ockn+OMClbpmMTvSUxftbP2sxD MUyJ8ERuja+JyOkDKeSXa/aWorRgvCRQRhHtE5gjlB0YRGZfDXj/eM9Ar8gRyWmZ 8yY60p6gsG0DoleltIilLKmsS/KwSj6nWZU0CQIjelgZ1dkqg=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=jdsG2jBBK4KH+dooQTJV+y6NJgq0mwEn+hZQnMN2+r/s4Yqq6zfyd6lf7JDdilJbceL4//ZZ2yBfqiYk+Du6jjf3KUvbHUSxd0bgQyIMKZTsnXXTjOQVGgI5Pwc1Pe6PJrBC+54D8JO2lO298VJCscd+R8/HZh2dvia2LEy9oYE=; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:OpenPGP:User-Agent;
- In-reply-to: <20080227174020.GA30153@SamZwo>
- List-post: <mailto:mutt-users@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-users"
- Mail-followup-to: mutt-users@xxxxxxxx
- Openpgp: id=CA8E235E; url=http://www.memoryhole.net/~kyle/kyle-pgp.asc; preference=signencrypt
- References: <20080227174020.GA30153@SamZwo>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.17 (2008-01-14)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday, February 27 at 06:40 PM, quoth Nathan Huesken:
>I invoke the script this way:
>macro index,pager a '<shell-escape>~/add2ldap<enter>'
>
>It then asks me for the name and eMail (because they are not given as
>paramters).
>So far so good, but I wonder if it is possible to automaticly extract name and
>sender from an eMail and pass them as parameters to add2ldap?
Sure, all you have to do is create a script that will extract those
details.
If, for example, you have DJB's mess822 package installed, you could
do something like this:
#!/bin/bash
FROM=`822field from`
if [[ $FROM =~ "<*@*>" ]] ; then
EMAIL=`sed 's/.*<\([^>]*\)>.*/\1/' <<<"$FROM"`
NAME=`sed 's/ *\(.*\) *<.*/\1/' <<<"$FROM"`
else
EMAIL="$FROM"
NAME=""
fi
exec add2ldap "$NAME" "$EMAIL"
If you don't have the mess822 package, you can do something similar if
you have the formail (part of the procmail package) binary handy. The
equivalent command would be:
FROM=`formail -c -x From`
~Kyle
- --
I have an existential map; it has 'you are here' written all over it.
-- Steven Wright
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iD8DBQFHxdARBkIOoMqOI14RAtOnAKDXwj+3Sv7YOfQBldKjay83lZcPwACcCMHu
5HpqldpCD1qq9n2qCGEq//4=
=poQT
-----END PGP SIGNATURE-----