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




Reply




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