Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use old style NeXTSTEP icons in Mail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use old style NeXTSTEP icons in Mail
Authored by: lowbatteries on Nov 15, '11 09:29:15AM

This hint is great! I've been looking for a way to add favicons to my email, as I deal with a lot of firms and it would be nice to identify them by their website favicon. I wrote this little function that I put in my ~/.profile:

function mailfav()
{
	EMAIL=$1;
	DOMAIN=${EMAIL#*@}
	
	mkdir -p ~/Library/Images/People
	wget http://$DOMAIN/favicon.ico -O ~/Library/Images/People/$EMAIL.tiff
}

Now, if I want to download a favicon for a particular address, I run this command in a terminal:

	mailfav apps-noreply@google.com

This downloads the favicon at http://google.com/favicon.ico and saves it as "apps-noreply@google.com.tiff" in the correct folder.



[ Reply to This | # ]
Use old style NeXTSTEP icons in Mail
Authored by: j-beda on Nov 15, '11 10:49:52AM

pretty spiffy.

wget is no longer included by default in Mac OS X, so I suppose I should figure out how to rewrite that line with "curl"



[ Reply to This | # ]
Use old style NeXTSTEP icons in Mail
Authored by: j-beda on Nov 15, '11 10:59:40AM
Maybe something like this would work? I think "curl" also will do the directory creation stuff:
function mailfav()
{
        EMAIL=$1;
        DOMAIN=${EMAIL#*@}

        curl http://$DOMAIN/favicon.ico --output ~/Library/Images/People/$EMAIL.tiff --create-dirs
}
Unfortunately, for the example given ("mailfav apps-noreply@google.com") google.com seems to store its favicon at www.google.com, so the curl as listed gives a http file with a 301 - "moved" error in it. Anyone know how to get it to follow 301?
Edited on Nov 15, '11 11:15:51AM by j-beda


[ Reply to This | # ]
Use old style NeXTSTEP icons in Mail
Authored by: eaganj on Nov 15, '11 02:18:44PM

just add the -L option to your curl command to follow redirects.



[ Reply to This | # ]
Use old style NeXTSTEP icons in Mail
Authored by: aMacUzur on Nov 15, '11 10:49:56PM

Add the "-L" parameter to curl to have it follow redirects, at least for instances like this one, anyway (read the man page for full details) — e.g.:

curl http://$DOMAIN/favicon.ico -L --output ~/Library/Images/People/$EMAIL.tiff --create-dirs

[ Reply to This | # ]
Use old style NeXTSTEP icons in Mail
Authored by: the_webmaestro on Nov 16, '11 09:16:44AM

How about this (NOTE: Untested and I don't know if it'll work! I'm hoping from a little 'free' guru help here! ;-):

function mailfav()
{
        EMAIL=$1;
        DOMAIN=${EMAIL#*@}

        curl http://www.$DOMAIN/favicon.ico --output ~/Library/Images/People/$EMAIL.tiff --create-dirs
}

It's inelegant, and if the site re-directs to a domain *without* www. we have the same problem.
This should allow re-directs:

function mailfav()
{
        EMAIL=$1;
        DOMAIN=${EMAIL#*@}

        curl -L http://$DOMAIN/favicon.ico --output ~/Library/Images/People/$EMAIL.tiff --create-dirs
}

By default the limit is set to 50 re-directions, but you can improve on that by adding the --max-redirs flag.

---
Happy Dad


[ Reply to This | # ]
Use old style NeXTSTEP icons in Mail
Authored by: j-beda on Nov 16, '11 11:17:49AM

That last one seems to work, at least with google.com



[ Reply to This | # ]