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:

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
GreenTools for G Suite (G4G) Updated to Include Delete and Empty Trash Function GreenTools for G Suite (G4G) Updated to Include Delete and Empty Trash Function
Posted by July 24, 2018
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
What to Do If Your License Keys Don't Work What to Do If Your License Keys Don't Work
Posted by July 18, 2018
BVSTools >> BVSTools Software Discussion
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

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