bvstone

Resending Emails that have Errored Out with Updated Router or Authentication Information

Posted:

Resending Emails that have Errored Out with Updated Router or Authentication Information

There are times when you will send emails from your IBM i, and for one reason or another (your quota was reached, your internet was down, etc) you may have a large group of emails that are not delivered and need to be resent.

Normally you could use the MTPLUGLOG command to resend individual emails, or the MTPRESEND command to resend all errored email messages at once.

But there may be a case, such as in the case of your sending quotas going over the limit, where you would need to change the email router and/or authentication information to resend the email.

When an email errors out with MAILTOOL (and MAILTOOL Plus), the email (MIME file) itself is saved in the IFS along with a unique JSON configuration for that email.  The details of the FROM address and TO, CC and BCC recipients are also stored in the MAILTOOL log files. 

One option is to edit each of the configuration files and manually change the information you need (router, user, password, etc) but when you have hundreds or thousands of emails to resend that is an overwhelming task.

Instead, when resending emails using either MTPLUSLOG or MTPRESEND, you have the option to specify a different and specific JSON configuration file.

                     MAILTOOL Plus Resend (MTPRESEND)                        

Type choices, press Enter.                                          
Send to All Recipients . . . . .   *ERR          *ERR, *YES        
Configuration File . . . . . . .   *DFT                            
Prompt Before Running  . . . . .   *YES          *YES, *NO

In this example, *DFT is specified for the configuration file.  This tells MAILTOOL to use the configuration file that was created during sending of the email when it errored out to resend.  But, we can override this parameter with a specific configuration file we can create manually and have that applied to all of the emails that are resent.

Let's assume we create an IFS file named /tmp/tempemail.json, and use the following settings:

{  
   "variables":[  
      {  
         "name":"from_email",
         "default":"<your from address>"
      },
      {  
         "name":"send_with_server_type",
         "default":"*MAILTOOL"
      },
      {  
         "name":"mail_router",
         "default":"smtp.gmail.com"
      },
      {  
         "name":"use_mail_router",
         "default":"*ONLY"
      },
      {  
         "name":"use_ssl",
         "default":"*YES"
      },
      {  
         "name":"smtp_port",
         "default":"465"
      },
      {  
         "name":"smtp_auth_user",
         "default":"<smtp auth user id>"
      },
      {  
         "name":"smtp_auth_password",
         "default":"<smtp_password>"
      }
   ]
}

You would need to replace items  in < > with the correct information.  The FROM address is required, but won't be changed, even if what you use is different from the original email as the FROM address and recipients are taken from the MAILTOOL log files and already in the MIME file itself.  But, the mail router, port, SSL setting, and authentication parameters can be overridden with new values that WILL be replaced when sending the email.

It is STRONGLY advised, once you create the JSON configuration file, that you could then run one or more tests from MTPLUSLOG making sure to override the configuration file with the one you created.  If it works, you should be able to use MTPRESEND and also override the configuration file with the one you created.


Last edited 08/17/2020 at 09:10:28




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