Email Attachments in Batches using R/Fysan
May 13, 2021
fysan is a niche package, ideal for people in facing this dilemma:
- You need to move many files from one computer to another. Images, text files, etc.
- You are unable to use normal tools such as FTP or Dropbox
- You are unable to share via USB. So no flash drives, CD/DVD burners etc.
- Bluetooth data sharing is prohibited
This sounds ridiculous but I was in this scenario and for that reason I built fysan.
Installation and Example
Here is a link to GitHub, where you can find installation instructions as well as an example with code: https://github.com/harryahlas/fysan
RDCOMClient
fysan requires the RDCOMClient package, which may not be available on CRAN for your version of R. You can install it from https://github.com/dkyleward/RDCOMClient as noted here: https://github.com/omegahat/RDCOMClient/issues/19.
We are assuming your machine has a COM email client, such as Outlook, already set up.
If you have need for this tool but do not use Outlook, it should be pretty straight forward to edit the fyleSender()
function with code for other email clients. Let me know if that would be useful.
Options
Several options are available you can choose:
- the number of attachments per email
- the number of seconds to wait after each email is sent
- which file extensions to search for and send
- what files to avoid sending based on text in the filename
- cc/Bcc
Log file
There is a log file saved in the current working directory. This log keeps track of files you have already sent. So if the process stops for some reason you can easily start again where you left off. This has been tested on Windows 10.