Copy file and attach it to email?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
m3user
Posts: 235
Joined: 17 Jan 2014, 18:11

Copy file and attach it to email?

Post by m3user » 01 Dec 2022, 15:08

My colleagues at work frequently need to send me a specific file (I have exact path) from their computer. They all use different email clients so I cannot use COM.
Is there any other way to automate (or semi-automate) this? I would send them a script which would copy the file and paste it (attach it) to a new email message to me.
Any idea is appreciated, thanks!

garry
Posts: 3772
Joined: 22 Dec 2013, 12:50

Re: Copy file and attach it to email?

Post by garry » 01 Dec 2022, 15:30

an example , thunderbird send an attached file

Code: Select all

filex   =c:\test.jpg                          ;- file to attach
ifnotexist,%filex%
  {
  msgbox,%filex% not exists .
  exitapp
  }
tox     =garry(at)gmail.com                   ;- << change adress         
subject =Test55
body    =FollowedLine1`%0AFollowedLine2

      TO=to='%TOX%'
      PR=%A_ProgramFiles%\Mozilla Thunderbird\thunderbird.exe
      SB=subject=%subject%
      AT=attachment='%FILEX%'
      BD=body=Hello M3user`%0A`%0AHow are you ?`%0A`%0A%body%`%0A`%0AGreetings`%2C`%0A`'`%09`%09%x%`%0A`%0A`%0AEND 

      ALL=%TO%,%SB%,%AT%,%BD%
      run,%PR% -compose "%ALL%"
exitapp

User avatar
mikeyww
Posts: 27049
Joined: 09 Sep 2014, 18:38

Re: Copy file and attach it to email?

Post by mikeyww » 01 Dec 2022, 16:39

I think that the question is how to do it for any e-mail client. As far as I know, mailto: does not handle this directly as part of the protocol. COM may be possible, though the message would not necessarily be "inserted" into a specific client's mailbox in doing that. One could determine which client is being used as the mail default, and customize a command line, where supported, for that client. Although many clients exist, I believe that only a small fraction of people use clients outside a small set. One could also use a Web server to host documents that could be downloaded or accessed in a variety of ways. Gmail is another story altogether....

m3user
Posts: 235
Joined: 17 Jan 2014, 18:11

Re: Copy file and attach it to email?

Post by m3user » 01 Dec 2022, 16:41

Thanks, this makes sense. Is there a way to determine the default email client?


Post Reply

Return to “Ask for Help (v1)”