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 Errors with Microsoft Office 365 (2020) MAILTOOL Errors with Microsoft Office 365 (2020)
Posted by September 3, 2020
BVSTools >> BVSTools Software Discussion >> Email Tools (MAILTOOL) Specific Discussion
Using MAILTOOL With Office 365 and Two Factor Authentication (2FA or MFA) Using MAILTOOL With Office 365 and Two Factor Authentication (2FA or MFA)
Posted by August 17, 2020
BVSTools >> BVSTools Software Discussion >> Email Tools (MAILTOOL) Specific Discussion
Updating DNS With Dynamic IP Addresses After a Router Reboot/Power Outage Updating DNS With Dynamic IP Addresses After a Router Reboot/Power Outage
Posted by August 16, 2020
Programming >> Proof of Concept (POC)
GETURI v10.10 Released with New ILE Functions GETURI v10.10 Released with New ILE Functions
Posted by August 12, 2020
BVSTools >> BVSTools Announcements >> Get URI (GETURI) Specific Announcements
MAILTOOL Updated to Allow G4GSMAIL as Option in Routers File MAILTOOL Updated to Allow G4GSMAIL as Option in Routers File
Posted by June 28, 2020
BVSTools >> BVSTools Announcements >> eMail Tool (MAILTOOL) Specific Announcements
BVSTools Now Offers Interface with Infor's ION APIs BVSTools Now Offers Interface with Infor's ION APIs
Posted by May 15, 2020
BVSTools >> BVSTools Announcements
More V7R4 IFS File CCSID Issues and The Fix More V7R4 IFS File CCSID Issues and The Fix
Posted by March 4, 2020
IBM Power Systems >> (QGPL) IBM i
Error Retrieving IP Address by Name Error Retrieving IP Address by Name
Posted by February 25, 2020
BVSTools >> BVSTools Software Discussion
Logging jobs that hit an outq Logging jobs that hit an outq
Posted by February 13, 2020
Programming >> CL Programming
GreenTools for Google Apps (G4G) v12.60 Released with Shared Drive Features and More... GreenTools for Google Apps (G4G) v12.60 Released with Shared Drive Features and More...
Posted by February 4, 2020
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
Allowing Requests over Port 80 For SSL Validation (ie, Namecheap, etc) Allowing Requests over Port 80 For SSL Validation (ie, Namecheap, etc)
Posted by January 31, 2020
Programming >> Web Programming
GreenTools for Slack (G4SLK) v3.00 Released GreenTools for Slack (G4SLK) v3.00 Released
Posted by January 17, 2020
BVSTools >> BVSTools Announcements >> GreenTools for Slack (G4SLK) Specific Announcements
Calling a QSH Command from RPG Calling a QSH Command from RPG
Posted by December 26, 2019
Programming >> RPG Programming
SPLTOOL Print Range (PRTRNG) Function Updated to Handle Spooled Files up to 999,999,999 Pages SPLTOOL Print Range (PRTRNG) Function Updated to Handle Spooled Files up to 999,999,999 Pages
Posted by December 14, 2019
BVSTools >> BVSTools Announcements >> Spooled File Tools (SPLTOOL) Specific Announcements
GreenTools for Microsoft Apps (G4MS) Updated to v6.00 - Now Uses Microsoft Graph APIs GreenTools for Microsoft Apps (G4MS) Updated to v6.00 - Now Uses Microsoft Graph APIs
Posted by November 24, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Microsoft Apps (G4MS) Specific Announcements

Reply




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