Mail File Batch Script
After getting FAR too many requests to connect to a server at an offsite location and somehow get a file from it to another location without any FTP client (bar the Windows CLI one), mail client etc. I decided to write this batch script which does the job quite nicely. I’ve created an MSI installer for it ‘cos it’s obviously for Windows only. If anyone finds a problem with it please let me know!
Download the MSI installer here
Here’s the read me.
Mail File Batch Script by Lewis Roberts
You'll need to edit the "mf.ini" file to reflect the settings
for your mail server. What it's called, username, password etc.
PLEASE also read the text in the settings file.
It is vital to the script's success that you do not change the
physical location that the settings begin in the mf.ini file.
THEY MUST BEGIN AT LINE ELEVEN (11).
Having problems? Read the problems section...
If you're reading this then you've probably already done it.
I specifically haven't added Mail File's install folder to the
PATH variable in Windows. Although it can be installed
literally anywhere you want, you must always invoke it from
place you install to so I suggest using the shortcut in the
Start Menu or copying it to your desktop. Don't be tempted to
add it to the PATH yourself, you'll find files get deleted!
Quickly and simply email a file to an email address.
The file is compressed using RAR, attached to an email and
sent using your mail server.
mf "[drive:][path][filename]" [email_address]
eg. mf "C:\My Documents\Picture 20.jpg" firstname.lastname@example.org
## YOU MUST WRAP THE FILE PATH AND NAME IN DOUBLE-QUOTES!
## NO ERROR CHECKING IS DONE ON THE EMAIL ADDRESS!
## RAR FILES ARE NOT RE-COMPRESSED!
Q: The batch script doesn't work!
A: You didn't wrap the path and filename in double-quotes or
you didn't set the variables inside the script before
running it or you set them wrongly. You need to edit the
script's variables to suit your environment.
Q: What/whos mail server should I use?
A: You could use your ISPs mail server or download your own.
At inception I used Argosoft Mail Server who have a
freeware mail server. If you're stuck on setting the
variables, contact your ISP or look at the documentation
they sent you when you signed up with them.
Q: It says it "Completed..." but no mail arrived/was sent!
A: Check the variables in the batch file. Each of the
processes involved (RAR and BLAT) use their own error
checking processes so look through the output from each
of those programs for obvious errors.