Page 1 of 1

Copy file and attach it to email?

Posted: 01 Dec 2022, 15:08
by m3user
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!

Re: Copy file and attach it to email?

Posted: 01 Dec 2022, 15:30
by garry
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

Re: Copy file and attach it to email?

Posted: 01 Dec 2022, 16:39
by mikeyww
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....

Re: Copy file and attach it to email?

Posted: 01 Dec 2022, 16:41
by m3user
Thanks, this makes sense. Is there a way to determine the default email client?

Re: Copy file and attach it to email?

Posted: 01 Dec 2022, 17:05
by mikeyww