Drop a file onto a desktop icon to attached it to a new email?

-1

Hello Superuser Community!

I already tried searching for a solution but I could not find anything. What I want to do is the following:

I would like to be able to drop one (or best any number) of files on an icon, and then automatically see a new email to a specific recipient opened and the files attached to it. I don't mind sending the mail manually, but I don't want to do all the stuff before that every time.

Additional info: I want to send stuff between two business laptops, so Dropbox is not an option, as is banned, and I also want the files to appear in the mails, and not just n the other computer.

Is this possible at all? I thought there might be some simple batch trick for this.

What I tried so far:

  • Googling for a vast arrangement of phrases similar to "batch drag and drop file to email icon" and reading through forum entries

  • Trying to drag and drop a file onto a shortcut to "mailto:a@b.com" -> no effect

  • Trying to find some batch script that does it, but I only found weird extensions to write emails from command line which is not what I want to do

Maxim Moloshenko

Posted 2016-04-18T14:34:48.997

Reputation: 113

2

Welcome to Super User! Please note that [SU] is not a script writing service. If you tell us what you have tried so far (including any scripts you are using) and where you are stuck then we can try to help with specific problems. You should also read How do I ask a good question?.

– DavidPostill – 2016-04-18T15:53:10.727

What email client are you using? Since each has different features and acts differently, this will be important to know. – CharlieRB – 2016-04-18T17:40:51.340

Answers

0

Short Version: You can, and it's not too hard, surprisingly.

Just a batch file will not do though, you need to utilize command line switches for a specific program.

For outlook, it does look like it is possible using command line switches:
https://support.office.com/en-us/article/Command-line-switches-for-Outlook-for-Windows-079164CD-4EF5-4178-B235-441737DEB3A6?ui=en-US&rs=en-US&ad=US

And for Thunderbird this can be done with the Compose Switch:
http://kb.mozillazine.org/Command_line_arguments_%28Thunderbird%29

And you can find how to utilize drag and drop support for a batch file from this link:
http://www.computing.net/answers/programming/drag-drop-files-to-batch-/20499.html

However, I have never really worked extensively in batch files. (The most I have done is make a portable version of Minecraft.) So I don't fully know the process used by the last link, but hopefully it is enough to set you on the right path.

Hope this Helps!

Gamerb

Posted 2016-04-18T14:34:48.997

Reputation: 834

This looks really promising, I will work through it and keep you updated! – Maxim Moloshenko – 2016-04-20T16:13:40.273

0

I managed to do it for one file, which was really easy in the end. Dropping multiple files still remains a challenge, as Outlook does not allow attaching several files through command line. My "code":

"C:\Program Files (x86)\Microsoft Office\Office15\outlook.exe" /c ipm.note /m "me@mail.de&subject=Files%%20sent&body=See%%20attachements" /a %1

To adapt:

  • Find the location of your Outlook .exe, and replace it
  • Change mail address, subject and body as you wish (space = %%20)

Maxim Moloshenko

Posted 2016-04-18T14:34:48.997

Reputation: 113

0

If you dont mind Using VBS instead of batch, this is a compilation from several places that I patched together to handle the same thing.

Save the code to a .vbs filename of your choice and put it on your desktop.

Create a nice icon for it and copy paste or drag and drop multiple files into it. As long as you drop them all at once, they are all attached to a single Outlook email which is immediately sent to the names you preconfigure in the script. If you want to take a look at your handiwork before sending, comment out the final line "oEmailItem.Send". Then it It swaits for a manual send.

Because of the limited filetypes accepted by Outlook as attachments, I would like to add the ability to zip all files dropped into the script but have not been able to get that to work yet.

If you can add this the component please post back with it.

Option Explicit
Dim objArgs, OutApp, oNameSpace, oInbox, oEmailItem, olMailItem
Dim a, oAttachments, subjectStr, olFormatHTML
olMailItem = 0
olFormatHTML = 2
Set objArgs = WScript.Arguments 'gets paths of selected files
Set OutApp = CreateObject("Outlook.Application") 'opens Outlook
Set oEmailItem = OutApp.CreateItem(olMailItem) 'opens new email
oEmailItem.To = "you@email.net"
oEmailItem.cc = "yourfriend@mailcom"
oEmailItem.bcc = "another@mailcom"
For a = 0 to objArgs.Count - 1
Set oAttachments = oEmailItem.Attachments.Add(objArgs(a))
subjectStr = subjectStr & Right(objArgs(a),Len(objArgs(a))-       (InStrRev(objArgs(a),"\"))) & ", " 'recreates the default Subject e.g. Emailing: file1.doc, file2.xls
Next
If subjectStr = "" then subjectStr = "No Subject "
oEmailItem.Subject = "Important Items " & Left(subjectStr,    (Len(subjectStr)-2))
oEmailItem.BodyFormat = olFormatHTML
oEmailItem.Display
oEmailItem.Send

questorfla

Posted 2016-04-18T14:34:48.997

Reputation: 37