Remote File Access Through E-Mail
—-
| Download: | shantz-outlook-remote-file |
|---|---|
| Version: | 0.1 |
| Updated: | April 23, 2008 |
| Size: | 1.19 KB |
| Hits: | 906 |
Introduction:
This is a (proof-of-concept) outlook macro that you can use with an outlook rule to retrieve your files from your home/office PC by sending it a mail with a subject having a predefined special keyword and the body containing the names and paths of the files. The remote PC will then mail you the files on a predefined e-mail ID.
This project came into being after reading this post at lifehacker (original post and solution here). It listed a method to retrieve mails on your home/office PC by sending a “magic email” to it, but it was only for mac’s. Seeing that people wanted it for windows as well, I thought of making something up during lunch time at office.
Usage:
1. Download the attached zip file (shantz-outlook-remote-file-access.zip) and unzip it. It has a VB module “shantz-outlook-remote-file-access.bas” (can be opened with any text editor)
2. Create a new macro in Outlook. Copy the code contained in Module1.bas to the main source file of the macro.
3. Edit the code to change the e-mail ID to which the files will be e-mailed. Save the macro.
4. Create a new rule in Outlook. Choose to run the rule when a specific word is found in the subject. e.g. use “SendMeMyFiles”.
5. The action part of the rule should be “run a script”. Here you can choose the macro that you just created from the list shown by Outlook.
6. Save the rule and you are done.
Now try, sending a mail to the account that your outlook is configured to receive mail for, with the special keyword in the subject and a list of files (with their complete absolute paths on the remote computer) separated by semicolons (”;” without the quotes), and watch magic happen :).
e.g.: To: myemail@email.com
subject: SendMeMyFiles
Body: c:\path\of\files\file1;d:\second\path\file2
IMPORTANT NOTES:
- For this thing to work, outlook has to be running on the remote PC as this depends on a “client-side” rule.
- This is just a proof-of-concept as of now, so there is no error handling right now. Plus the e-mail body parsing is finicky and so the e-mail body should not have anything other than the file paths and names. This might change in future if I decide to update it.
- Don’t use it if your life depends on it. Use it for basic purposes and modify and improve it appropriately before you decide to use it seriously (You may submit your modifications here as well)
- It has been tested only on Outlook 2003, but might work on others as well.
Let me know of any thoughts you may have about this.
—-
If you liked this post, then you can Subscribe to my feed












February 19th, 2008 at 11:22 pm
[...] Remote File Access Through E-Mail [...]
February 20th, 2008 at 12:20 pm
fundooo!!!!
Thats cool !
February 20th, 2008 at 5:53 pm
thnx rohit
February 20th, 2008 at 6:37 pm
[...] Don’t have a Mac, windows users click here for similar [...]
February 21st, 2008 at 5:50 am
[...] great way to retrieve the file you forgot, and you can retrieve it anywhere you have email access. Remote File Access Through E-Mail [My Technophilic Musings via [...]
February 21st, 2008 at 6:33 am
When you set up the macro in Outlook, I’m assuming you set up a new macro name, I used ‘remote’
So then you you hit create and you get the following code:
Sub remote()
End Sub
Are you supposed to paste your code in between the sub and end sub? Like so:
Sub remote()
Attribute VB_Name = “Module1″
Function mail(strTo As String, _
strSubject As String, _
strMessageBody As String, _
Optional strAttachments As String) As Boolean
Dim MAPISession As Outlook.NameSpace
Dim MAPIFolder As Outlook.MAPIFolder
Dim MAPIMailItem As Outlook.MailItem
Dim oRecipient As Outlook.Recipient
Dim TempArray() As String
Dim varArrayItem As Variant
Dim blnSuccessful As Boolean
Set MAPISession = Application.Session
If Not MAPISession Is Nothing Then
MAPISession.Logon , , True, False
Set MAPIFolder = MAPISession.GetDefaultFolder(olFolderOutbox)
If Not MAPIFolder Is Nothing Then
Set MAPIMailItem = MAPIFolder.Items.Add(olMailItem)
If Not MAPIMailItem Is Nothing Then
With MAPIMailItem
TempArray = Split(strTo, “;”)
For Each varArrayItem In TempArray
Set oRecipient = .Recipients.Add(CStr(Trim(varArrayItem)))
oRecipient.Type = olTo
Set oRecipient = Nothing
Next varArrayItem
.Subject = strSubject
If StrComp(Left(strMessageBody, 6), “”, vbTextCompare) = 0 Then
.HTMLBody = strMessageBody
Else
.Body = strMessageBody
End If
TempArray = Split(strAttachments, “;”)
For Each varArrayItem In TempArray
varArrayItem = CStr(moreTrim(varArrayItem))
.Attachments.Add varArrayItem
Next varArrayItem
.Send
Set MAPIMailItem = Nothing
End With
End If
Set MAPIFolder = Nothing
End If
MAPISession.Logoff
End If
blnSuccessful = True
End Function
Public Function moreTrim(ByVal sValue As String) As _
String
Dim sAns As String
Dim sWkg As String
Dim sChar As String
Dim lLen As Long
Dim lCtr As Long
sAns = sValue
lLen = Len(sValue)
If lLen > 0 Then
For lCtr = 1 To lLen
sChar = Mid(sAns, lCtr, 1)
If Asc(sChar) > 32 Then Exit For
Next
sAns = Mid(sAns, lCtr)
lLen = Len(sAns)
If lLen > 0 Then
For lCtr = lLen To 1 Step -1
sChar = Mid(sAns, lCtr, 1)
If Asc(sChar) > 32 Then Exit For
Next
End If
sAns = Left$(sAns, lCtr)
End If
moreTrim = sAns
End Function
Sub intercept(MyMail As MailItem)
Dim strID As String
Dim objNS As Outlook.NameSpace
Dim objMail As Outlook.MailItem
Dim replyto As String
Dim result As Boolean
Dim file As String
strID = MyMail.EntryID
Set objNS = Application.GetNamespace(”MAPI”)
Set objMail = objNS.GetItemFromID(strID)
file = objMail.Body
result = mail(”abc@abc.com”, file, “”, file)
End Sub
End Sub
?????
If so, there are syntax errors when I try and call the macro … please help!
February 21st, 2008 at 9:06 am
Awesome. I will use this script to make outlook do other stuff for me.
February 21st, 2008 at 9:54 am
@llcooljayce:
You need to “replace” the default code that is present by the source code that I just gave. (Remove the top line which says Module “shantz-….”). Otherwise, you can delete the default file that is there and import the file that I gave…
February 21st, 2008 at 9:55 am
@JJMelo: thnx. Do send me a word if you do any modifications
February 21st, 2008 at 11:35 am
Really very cool!! Nice job!!
February 21st, 2008 at 12:11 pm
thnx pradeep
February 21st, 2008 at 9:13 pm
Or, you could just use this free program…
http://www.runtime.org/remotebymail.htm
February 21st, 2008 at 10:01 pm
@Steven: yeah, the solution is just one amongst the sea of others available :), some might find it useful because they can’t use other methods because of restrictions (e.g. installing new softwares)….
February 21st, 2008 at 10:35 pm
[...] way to retrieve the file you forgot, and you can retrieve it anywhere you have email access.” Remote File Access Through E-Mail [My Technophilic Musings via [...]
February 22nd, 2008 at 12:22 am
[...] [Remote file access through email] via [Lifehacker] [...]
February 22nd, 2008 at 3:49 am
[...] Remote File Access Through E-Mail (tags: email remote file howto) [...]
March 5th, 2008 at 3:36 am
Great website!! Keep up the good work!!
March 12th, 2008 at 6:08 am
cool concept! Could it be re-written to place a file on a computer in a specific folder?
March 12th, 2008 at 9:59 am
@jack, yes, it can be rewritten for that..infact it can be modified to do a lot of things, like even shutting down/restarting your computer, running external programs, even modifying files, and what not. Only limitations are:1. How far can you imagine :)2. How much you know (or are willing to learn) about outlook macro scripting.
April 16th, 2008 at 10:38 pm
[...] just a neat way to grab a file. Using a keyword and a filename, you can set up Mail.app on Macs or Outlook on PCs to send you your files. If nothing else, you might convince your co-workers that you have magic [...]
April 16th, 2008 at 11:02 pm
[...] just a neat way to grab a file. Using a keyword and a filename, you can set up Mail.app on Macs or Outlook on PCs to send you your files. If nothing else, you might convince your co-workers that you have magic [...]
April 16th, 2008 at 11:23 pm
[...] just a neat way to grab a file. Using a keyword and a filename, you can set up Mail.app on Macs or Outlook on PCs to send you your files. If nothing else, you might convince your co-workers that you have magic [...]
April 17th, 2008 at 12:33 am
[...] just a neat way to grab a file. Using a keyword and a filename, you can set up Mail.app on Macs or Outlook on PCs to send you your files. If nothing else, you might convince your co-workers that you have magic [...]
April 17th, 2008 at 1:49 am
[...] just a neat way to grab a file. Using a keyword and a filename, you can set up Mail.app on Macs or Outlook on PCs to send you your files. If nothing else, you might convince your co-workers that you have magic [...]
April 18th, 2008 at 2:44 pm
Great idea. Problem is I would rarely remember the full path of the file.
I think this could be enhanced by asking for a text file oitlining the folder structure first.
For example:
Subject: MailFolderList
C:\ProjectFolder
The result would be a .txt file with all folders and files in it. Then you could execute the retrieve file email.
April 18th, 2008 at 3:25 pm
Yes Jason, you are absolutely right about that. This is just a proof of concept. Basically how I would build on it is that the subject would always remain the same, but the body can contain “commands” followed by arguments and may even contain multiple commands. So u can say smthing like:
shell:dir >c:\files.txt
mailback: c:\files.txt
May 2nd, 2008 at 2:31 pm
wow….thanks for the download file. it’s very helpful.
May 2nd, 2008 at 2:54 pm
arejae, glad you liked it.
May 10th, 2008 at 1:08 pm
i am using and it work nicely.