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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
Mail File Batch Script by Lewis Roberts GETTING STARTED: 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... INSTALLATION: 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! INSTRUCTIONS: 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. Syntax: mf "[drive:][path][filename]" [email_address] eg. mf "C:\My Documents\Picture 20.jpg" john@doe.com ## 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! PROBLEMS: 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. |