Download Mail plugin pre-sales question

By ht1080z - August 24, 2021 - edited: August 24, 2021

Hi,

I hope everybody had a wonderful summer!

A quick question about the Download Mail plugin:

Can I link emails to another table (example: "Applications" that users registered on the website and with attachments sent via emails to a selected and connected-with Download Mail plugin)?
Do I need to put some unique variable to the email subject so I can link each specific email with the related records?

Any help would be much appreciated,
Karls

By daniel - August 25, 2021

Hi Karls,

No, there isn't any way of doing this with the base plugin - it would require some custom programming to check the emails after they've been downloaded and add the links to other tables as necessary. If you're interested in trying to do this I can provide some guidance about where to start, or if you'd like some more hands-on help feel free to send us a request for a free estimate: https://www.interactivetools.com/estimate/

Thanks,

Daniel
Technical Lead
interactivetools.com

By ht1080z - August 26, 2021

Hi Daniel,

Thank you for your reply. Please provide me some guidance about where to start and look at this first better.

Thanks again,
Karls

By daniel - August 26, 2021

Hi Karls,

The way I'd approach this is to create a plugin that runs a regular background task to look for downloaded mail and process any new items. To set up a background task, you would use theĀ addCronJob() function, which would look something like this:

addCronJob('your_function_name_here', "Description of task", '* * * * * *');

This function will add a task to CMSB's Background Tasks, and will execute a function you specify in the first parameter at the interval specified in the 3rd parameter (learn more about cron interval formatting here: https://support.acquia.com/hc/en-us/articles/360004224494-Cron-time-string-format). Note that you'll also need to enable CMSB Background Tasks by setting up a cron job on your server - instructions for this can be found on the Background Tasks page, under Admin Menu.

Once you have the task running, you'll want to use the function to check for new downloaded mail records (in table "_incoming_mail" by default), determine if they need to be linked to another table, and update any necessary fields. The Incoming Mail table comes by default with a "processed" field, which you can update to track which mail records have already been checked by your function.

Let me know if you have any other questions!

Thanks,

Daniel
Technical Lead
interactivetools.com

By ht1080z - August 26, 2021

Hi Daniel,

Thank you for your help. I'll definitely take a deep dive on this.

Karls