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:

MAILTOOL Updated to Allow Failed Message on Invalid Recipient MAILTOOL Updated to Allow Failed Message on Invalid Recipient
Posted by May 20, 2018
BVSTools >> BVSTools Announcements >> eMail Tool (MAILTOOL) Specific Announcements
Non HTTPS Callbacks Removed from GreenTools for G Suite (G4G) Non HTTPS Callbacks Removed from GreenTools for G Suite (G4G)
Posted by April 15, 2018
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
IBM i Related Survey Available IBM i Related Survey Available
Posted by April 7, 2018
IBM Power Systems >> (QGPL) IBM i
BVSTools Releases Braintree Webhook Open Source Application - Node.js BVSTools Releases Braintree Webhook Open Source Application - Node.js
Posted by April 5, 2018
Programming >> Open Source
BVSTools Now Offering Web Services (BETA) BVSTools Now Offering Web Services (BETA)
Posted by April 3, 2018
BVSTools >> BVSTools Announcements
Creating a Reverse SSL Proxy Using RPG on the IBM i - Part 2 Creating a Reverse SSL Proxy Using RPG on the IBM i - Part 2
Posted by March 29, 2018
Programming >> Web Programming
Still on V7R1 or Earlier?  Here's Why You Should Upgrade NOW! Still on V7R1 or Earlier? Here's Why You Should Upgrade NOW!
Posted by February 21, 2018
IBM Power Systems >> (QGPL) IBM i
Converting a MMDDYY date format to YYMMDD for Sorting Using SQL Converting a MMDDYY date format to YYMMDD for Sorting Using SQL
Posted by February 16, 2018
Programming >> RPG Programming
Moving All Files from a Google Drive Folder to the Trash Using GreenTools for Google Apps (G4G) Moving All Files from a Google Drive Folder to the Trash Using GreenTools for Google Apps (G4G)
Posted by February 3, 2018
BVSTools >> BVSTools Software Discussion >> GreenTools for G Suite (Google Apps) (G4G) Specific Discussion
Removing Unwanted Characters from a String with RPG Removing Unwanted Characters from a String with RPG
Posted by February 2, 2018
Programming >> RPG Programming
GETURI Version 8.10 Released GETURI Version 8.10 Released
Posted by January 23, 2018
BVSTools >> BVSTools Announcements >> Get URI (GETURI) Specific Announcements
BVSTools is Now a Sponsor of ALLAS400S.com BVSTools is Now a Sponsor of ALLAS400S.com
Posted by January 17, 2018
BVSTools >> BVSTools Announcements
Service Pack SP171219 Released for G4PP v3.10 Service Pack SP171219 Released for G4PP v3.10
Posted by December 20, 2017
BVSTools >> BVSTools Announcements >> GreenTools for PayPal (G4PP) Specific Announcements
GETURI Now Requires Minimum OS of V7R1 or Higher GETURI Now Requires Minimum OS of V7R1 or Higher
Posted by December 12, 2017
BVSTools >> BVSTools Software Discussion >> Get URI (GETURI) Specific Discussion
Need Help Updating Your Software Versions?  We Can Help. Need Help Updating Your Software Versions? We Can Help.
Posted by December 8, 2017
BVSTools >> BVSTools Announcements

Reply




Copyright 1983-2018 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).