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:

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 8 hours ago
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
Resending Emails that have Errored Out with Updated Router or Authentication Information Resending Emails that have Errored Out with Updated Router or Authentication Information
Posted by March 1, 2019
BVSTools >> BVSTools Software Discussion >> Email Tools (MAILTOOL) Specific Discussion
BVSTools Offers Toolset to Work With HubSpot OAuth 2.0 APIs On Your IBM i BVSTools Offers Toolset to Work With HubSpot OAuth 2.0 APIs On Your IBM i
Posted by January 27, 2019
BVSTools >> BVSTools Announcements
G4MSDRV Currently Not Supported G4MSDRV Currently Not Supported
Posted by January 17, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Microsoft Apps (G4MS) Specific Announcements
Removing Trailing Carriage Returns and/or Line Feeds from a String with RPG Removing Trailing Carriage Returns and/or Line Feeds from a String with RPG
Posted by December 26, 2018
Programming >> RPG Programming
Create QRCODE in DDS Create QRCODE in DDS
Posted by September 21, 2018
Programming >> RPG Programming
Base64 Encoding a File with RPG Base64 Encoding a File with RPG
Posted by September 6, 2018
Programming >> RPG Programming
Building JSON with RPG and YAJL and Writing to Standard Output Building JSON with RPG and YAJL and Writing to Standard Output
Posted by August 31, 2018
Programming >> Proof of Concept (POC)
How to Delete Files or Empty Trash From Your Google Drive with your IBM i and RPG/ILE How to Delete Files or Empty Trash From Your Google Drive with your IBM i and RPG/ILE
Posted by July 24, 2018
BVSTools >> BVSTools Software Discussion >> GreenTools for G Suite (Google Apps) (G4G) 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).