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:

GreenTools For G Suite (G4G) v12.00 Released With Base OAuth 2.0 Functionality GreenTools For G Suite (G4G) v12.00 Released With Base OAuth 2.0 Functionality
Posted by July 28, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
BVSTools Small Price Increase in 2020 BVSTools Small Price Increase in 2020
Posted by July 26, 2019
BVSTools >> BVSTools Announcements
GreenTools for Vertex Cloud (VTXCLOUD) Now Available GreenTools for Vertex Cloud (VTXCLOUD) Now Available
Posted by July 22, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Vertex Cloud (VTXCLOUD) Specific Announcements
GreenTools for Google Apps (G4G) - Drive Addon Successfully Verified by Google GreenTools for Google Apps (G4G) - Drive Addon Successfully Verified by Google
Posted by July 22, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
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 July 17, 2019
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

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