Home > Programming, SysAdmin, Technology > Adding an Email Signature in GMail with RSS

Adding an Email Signature in GMail with RSS

August 14th, 2011 Leave a comment Go to comments

GMail recently took away the ability to have an RSS feed create signatures for us. Luckily I’ve been using Wisestamp (http://www.wisestamp.com) for years, and it is just the thing you need. With it, you can take the output of any RSS feed and put the text at the bottom of your signature in every email you send out.

http://blog.atcp.us/wp-admin/post.php?post=3049&action=edit&message=1

Above, I’ve created a simple signature in Wisestamp, and when you do this in the editor, you have some really diverse choices below.

The one we’re interested in is the one simply called RSS. To bring RSS articles into your signature, you simply put the URL of the feed in. You don’t even need a title:

Here, I just pointed toward a perl script. Why? Because we’re going to roll our own RSS feed for GMail! It’s a lot easier than you think, and we won’t need anything else but what perl comes with naturally.

We do this in 2 files:

– A quoteFile (which will hold each quote, one per line)

– A perl script (sigv2.pl) to call from our signature application (that will serve up a random RSS article from the above file)

So, in any account you have access to a shell in, create a file of any name, and have your quotes in it-one per line (below is wrapping, obviously):

“It may be a blessing in disguise. … Something happened a long time ago in Haiti, and people might not want to talk about it. Haitians were originally under the heel of the French. You know, Napoleon the third, or whatever. And they got together and swore a pact to the devil. They said, we will serve you if you will get us free from the French. True story. And so, the devil said, okay it’s a deal. Ever since they have been cursed by one thing after the other.” -Pat Robertson, on the earthquake in Haiti that destroyed the capital and killed tens of thousands of people, Jan. 13, 2010
“I’m a huge supporter of women. What I’m not is a supporter of liberalism. Feminism is what I oppose. Feminism has led women astray. I love the women’s movement-especially when walking behind it.” -Rush Limbaugh, responding to criticism that he is sexist and defending his selection as one of the judges at the 2010 Miss America Pageant, “Fox News’ Fox & Friends”, February 3, 2010
“Marriage is not a civil right. You’re not black.” -Ann Coulter, arguing in front of a group of gay conservatives that the 14th Amendment only applies to African-Americans and that it does not, in fact, apply to women, LGBT people, or other  minorities, Sept. 26, 2010
“[Canadians] better hope the United States does not roll over one night and crush them. They are lucky we allow them to exist on the same continent.” -Ann Coulter, on Fox News, November 30, 2004
Ann Coulter: “You will find liberals always rooting for savages against civilization.” Bill O’Reilly: “They didn’t root for the Nazis against civilization.”Coulter: “Oh yes they did. It was only when Hitler invaded their precious Soviet Union that at the last minute they came in and suddenly started saying,  ‘Oh no, now you have to fight Hitler.'” -‘The O’Reilly Factor’ May 7, 2010
“I think [women] should be armed but should not vote…women have no capacity to understand how money is earned. They have a lot of ideas on how to spend it…it’s always more money on education, more money on child care, more money on day care.” -Ann Coulter, on “Politically Incorrect” February 26, 2001

Now all we need is the second part. Just write a simple Perl script (executable by your web server’s user) to serve up quotes from the above file just like a well behaved RSS feed:

#!/usr/local/bin/perl
#
# just call like any other RSS feed…
#
#####
#
# a home-grown RSS feed!
#
my $f;          # the entire message from this feed
my @sigs;
open(SIGS, “< quoteFile”) or die “Can’t open file”;
while(<SIGS>){
chomp;
push(@sigs, $_);
}

my $i = int(rand(scalar @sigs));
my $sig = $sigs[$i];
#
#####
#
# now for the RSS part that will serve the chosen quote from above
#
$f = “Content-type: application/rss+xml\n\n”;
$f .= “<?xml version=\”1.0\” encoding=\”utf-8\”?>”;
$f .= “<rss version=\”2.0\” xmlns:atom=\”http://www.w3.org/2005/Atom\”>\n”;
$f .= “<channel>\n”;
$f .= “<atom:link href=\”http://atcp.us/sigs/test1.pl\” rel=\”self\” type=\”application/rss+xml\” />\n”;
$f .= “<title>The title of my RSS 2.0 Feed</title>\n”;
$f .= “<link>http://linkedin.com/in/PatTrainor</link>\n”;
$f .= “<description>Now you understand my humor…</description>\n”;
$f .= “<lastBuildDate>Mon, 12 Sep 2015 18:37:00 GMT</lastBuildDate>\n”;
$f .= “<language>en-us</language>\n”;
$f .= “<item>\n”;
#
# this next line is what will show up in the Wisestamp signature for this RSS feeed:
#
$f .= “<title>” . $sig . “</title>\n”;
#
#####
#
# if they click the title (above), they will go to the URL below:
#
$f .= “<link>http://linkedin.com/in/PatTrainor</link>\n”;
#
#####
#
$f .= “<guid>http://linkedin.com/in/PatTrainor</guid>\n”;
$f .= “<pubDate>Mon, 12 Sep 2015 18:37:00 GMT</pubDate>\n”;
$f .= “<description>[CDATA[ This is the description. ]]</description>\n”;
$f .= “</item>\n”;
$f .= “</channel>\n”;
$f .= “</rss>\n”;
#
#
#
print $f . “\n”;

[puzzle: can you see from the below where the user is taken that clicks on the quote?]

So now you see how to make a simple RSS feed out of thin air. Not only that, but you can make it say what you like, and even bring the user/client somewhere when they click the link. As a result, my signature looks like this:

And that is how you make your very own RSS feed from a single Perl script, that also gives you a random ‘article‘ whenever you hit it, suitable for Wisestamp to include in your GMail (or other email systems Wisestamp supports) account.

Remember, you can use a script like this to template your very own RSS feed, feeding up any kind of data you like-on demand! Pretty nifty stuff, and perhaps even useful!

pat

P.S. Since you held on this long, here is a treat for you. My online Perl script is here, and my quote file grows all the time, with the latest version here.

Categories: Programming, SysAdmin, Technology Tags:
  1. No comments yet.
  1. No trackbacks yet.

 

%d bloggers like this: