bvstone

How we use MAILTOOL and G4G for software keys and reminders

Posted:

How we use MAILTOOL and G4G for software keys and reminders

Our software normally comes about because of a specific need we have.  There couldn't be a better example of this than our MAILTOOL and G4G software.

For years we've been using GMail as the mail server for our company.  It's worked pretty much flawlessly.  The only issue we had was to send emails from our IBM i (AS/400) we needed to enable SSL/TLS and authentication in our mail software.  That's where MAILTOOL Plus came about.

When a customer downloads software and/or requests a trial key for our software, our website (www.bvstools.com) which runs on an IBM i will automatically email a 30 day trial key to that customer.

In the past we would go through these emails and manually send reminders to the customer a few days later asking how things were going with the trial, and to let them know that they are more than welcome to request another 30 day key.  We work in the IT field too and know that sometimes you get taken off a project and put on another.

Now, sending all these emails out took a lot of our time, especially with how many key requests we get in a day.  So, we though why not create something that will automatically send the reminder emails.  And that's where the Google Calendar addon for G4G came to be.

Now when a customer requests a key, we add an entry to a specific Google Calendar that is just for key requests 15 days from the date that the request was made.  Here's a snippet of that source code:

CalDate = %date() + %days(15);                                       
CalTime = %time();                                                   
                                                                     
rc = #g4gcal_setValue('id':'bvstone@bvstools.com');                  
rc = #g4gcal_setValue('calendar_id':'mycalendarid');                          
rc = #g4gcal_setValue('event_title':%trimr(WPEmail) + ' - ' + %trimr(WPSoftware));   
rc = #g4gcal_setValue('start_date':%char(CalDate:*USA0));            
rc = #g4gcal_setValue('start_time':%char(CalTime:*HMS0));            
rc = #g4gcal_setValue('end_date':%char(CalDate:*USA0));              
rc = #g4gcal_setValue('end_time':%char(CalTime:*HMS0));              
rc = #g4gcal_setValue('event_key':WPEmail);                          
rc = #g4gcal_setValue('event_description':WPSoftware); 
rc = #g4gcal_addEvent(eventID);
               

Every morning (via a job scheduled entry) our IBM i requests the calendar events for that day.  If it finds one, it knows to send an email and to which user.

PGM                                                     
DCL        VAR(&DATE6) TYPE(*CHAR) LEN(6)               
DCL        VAR(&DATE8) TYPE(*CHAR) LEN(8)               
                                                        
RTVSYSVAL  SYSVAL(QDATE) RTNVAR(&DATE6)  
               
CVTDAT     DATE(&DATE6) TOVAR(&DATE8) TOFMT(*MDYY) +    
             TOSEP(*NONE)                               
G4GLSTEVT  ID(bvstone@bvstools.com) +                 
             CALID(mycalid) +   
             FROMDATE(&DATE8) TODATE(&DATE8) +        
             EVTOPT(*REPLACE)                         
                                                      
CALL       PGM(AUTOEML)                               
                                                      
ENDPGM                                                

 

      /free
       // create the email body using eRPG SDK here

       Subject = 'Software Evaluation Followup from BVSTools.com';


       if (#mailtool_init() >= 0);
         rc = #mailtool_setValue('configuration_file':
                '/bvstools/bvstools_mailtool.json');
         rc = #mailtool_loadDefaults();
         rc = #mailtool_addTORecipient(Email);
         rc = #mailtool_setValue('subject':Subject);
         rc = #mailtool_setValue('message':'*ATT');
         rc = #mailtool_addAttachment(tempout);
         rc = #mailtool_sendMail(errMsg);
       endif;

To make the code more readable, we've cut out a lot.  First the CL retrieves all the calendar entries for that day.  Those entries are placed into a physical file which the RPG program that is called reads through.  For each entry it will send an email.  But, because each email is unique to a user who downloaded software that means the name, email address and software downloaded is all different.

This means we want to create the body of the email as a stream file.  We use our eRPG SDK to do this.  This part is commented out in the source shown above, but what it basically does is create a nicely formatted email specific to the user and the software (or multiple pieces of software) that was downloaded.  

Finally, MAILTOOL is used to send the email.

So as you can see, incorporating software such as G4G can really save you a lot of time by automating jobs that you otherwise would be spending a lot of manual time on.


Last edited 06/09/2015 at 15:26:14



Latest Posts:

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
V7R4 Changes CCSID of Compressed File Using PASE JAR Command - Here's The Fix V7R4 Changes CCSID of Compressed File Using PASE JAR Command - Here's The Fix
Posted by November 21, 2019
IBM Power Systems >> (QGPL) IBM i
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 November 11, 2019
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

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).