bvstone

Creating Random Email Signatures with GMail

Posted:

Creating Random Email Signatures with GMail

I remember years ago, before the use of a web client for email, that we had scripts that would let us insert a random quote to the signature of each email we sent out.  I personally had a ball with this as I was a huge Seinfeld fan, so finding a list of funny Seinfeld quotes was the hard part, but once I had the list of quotes, each email I sent I hoped would instilled a little smile, no matter the topic.

I had the same question when it came to the GMail web client.  I found a Chrome add on named Signature Wizard that looked like it might do the trick, and it did!

Signature Wizard allows you to specify a URL (which is required to be SSL or https) to the location of your signature.  So what it does is grab the contents of that URL (as if it were a web page) and insert it into the bottom of the email.

Well, in my case I created an eRPG (CGI) program as my URL.  I filled a folder up with quotes (in this case, reasons why MAILTOOL is awesome) and tested away.

The setup/options screen for Signature Wizard is very straightforward and easy to use:

Once I got this set up, I tried it out.  But nothing worked.  That's because I forgot you should stop and restart Chrome for the addon to take affect.  Not the first time I've forgotten that!

But, once it was done, things were working great!  Each email now would have a random quote inserted into it.  Random because of the eRPG program (or CGI script) that I was using was in itself generating which template file to use and to output when it is called.

The program is very simple, and looks like this:

H DFTACTGRP(*NO) BNDDIR('ERPGSDK')                                                   
 ****************************************************************                    
 * Prototypes                                                   *                    
 ****************************************************************                    
 /COPY QCOPYSRC,P.ERPGSDK                                                            
 ****************************************************************                    
D randNum         S             10i 0                                                
D numSigs         S             10i 0  INZ(23)                                       
 ****************************************************************                    
 /free                                                                               
  #startup();                                                                        
  #writeTemplate('stdhtmlheader.erpg');                                              
  
  exec sql                                                                           
    set :randNum = RAND() * :numSigs;                                                
                                                                                     
  #writeTemplate('signatures/sig' + %char(randNum) + '.html');                       
  #cleanup();                                                                        
  *INLR = *ON;  
/end-free                                                                                          

First, we use the eRPG SDK to write out standard HTTP headers.  Next, we use the SQL RAND() function to generate a random number.  We multiply that number times the number of signatures (numbered from 0 to 22) so that the number is an integer between 0 and 22.  We use that number to create the path to the signature we want to add.  

Now, we open a new message, or reply to an existing message and the quote is added automatically for us.  

I did find that it really didn't get added until I clicked on the message window, or the send button.  But it does indeed work rather nicely!

Very simple and effective!


Last edited 06/27/2017 at 15:08:01



Latest Posts:

Using GETURI to Make OAuth 2.0 Requests - Custom Headers for Access Tokens Using GETURI to Make OAuth 2.0 Requests - Custom Headers for Access Tokens
Posted by 2 days ago
BVSTools >> BVSTools Software Discussion >> Get URI (GETURI) Specific Discussion
GreenTools for Microsoft Apps (G4MS) v5.00 Released with Updated OneDrive Support and 3rd Party Functionality GreenTools for Microsoft Apps (G4MS) v5.00 Released with Updated OneDrive Support and 3rd Party Functionality
Posted by October 20, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Microsoft Apps (G4MS) Specific Announcements
BVSTools is Now Running V7R4M0 BVSTools is Now Running V7R4M0
Posted by September 28, 2019
BVSTools >> BVSTools Announcements
GreenTools for G Suite (G4G) Now Includes Send Mail Functionality (G4GSMAIL Addon) GreenTools for G Suite (G4G) Now Includes Send Mail Functionality (G4GSMAIL Addon)
Posted by August 27, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
GreenTools For G Suite (G4G) v12.00 Released With Base OAuth 2.0 Functionality GreenTools For G Suite (G4G) v12.00 Released With Base OAuth 2.0 Functionality
Posted by July 28, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
BVSTools Small Price Increase in 2020 BVSTools Small Price Increase in 2020
Posted by July 26, 2019
BVSTools >> BVSTools Announcements
GreenTools for Vertex Cloud (VTXCLOUD) Now Available GreenTools for Vertex Cloud (VTXCLOUD) Now Available
Posted by July 22, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Vertex Cloud (VTXCLOUD) Specific Announcements
GreenTools for Google Apps (G4G) - Drive Addon Successfully Verified by Google GreenTools for Google Apps (G4G) - Drive Addon Successfully Verified by Google
Posted by July 22, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
Why I Cancelled my DynDNS Service and How I Replaced It with an IBM i Application Why I Cancelled my DynDNS Service and How I Replaced It with an IBM i Application
Posted by July 17, 2019
IBM Power Systems >> (QGPL) IBM i
Green Tools for G Suite (G4G) Product Updates (Licensing, Functionality, Base Product) Green Tools for G Suite (G4G) Product Updates (Licensing, Functionality, Base Product)
Posted by July 13, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
Reading JSON Data from Standard Input With YAJL and RPG Reading JSON Data from Standard Input With YAJL and RPG
Posted by July 12, 2019
Programming >> Proof of Concept (POC)
MAILTOOL Updated to Allow Use of IBM Global Security Kit (GSKIT) for SSL/TLS Communications MAILTOOL Updated to Allow Use of IBM Global Security Kit (GSKIT) for SSL/TLS Communications
Posted by June 19, 2019
BVSTools >> BVSTools Announcements >> eMail Tool (MAILTOOL) Specific Announcements
GETURI v10.00 Released Supporting IBM Global Security Kit (GSKIT) and Server Name Indication (SNI) GETURI v10.00 Released Supporting IBM Global Security Kit (GSKIT) and Server Name Indication (SNI)
Posted by June 11, 2019
BVSTools >> BVSTools Announcements >> Get URI (GETURI) Specific Announcements
BVSTools Now Offers Vertex Cloud Interface BVSTools Now Offers Vertex Cloud Interface
Posted by April 15, 2019
BVSTools >> BVSTools Announcements
Token Has an Invalid Signature Error for Office 365 Email Token Has an Invalid Signature Error for Office 365 Email
Posted by March 22, 2019
BVSTools >> BVSTools Software Discussion >> GreenTools for Microsoft Apps (G4MS) Specific Discussion

Reply




Copyright 1983-2019 BVSTools
GreenBoard(v3) Powered by the eRPG SDK, MAILTOOL Plus!, GreenTools for Google Apps, jQuery, jQuery UI, BlockUI, CKEditor and running on the IBM i (AKA AS/400, iSeries, System i).