Hi everybody,
I'd like to send files from my application using the windows biuld-in function "sendto/email recipient" (don't know it's name in english, can be found in explorer kontext menu). The reasons are
* I don't need to know what email client is installed
* my application's user doesn't need to know any server oder auth passwords or ...
* nothing will happen hidden behind user's back
Is there a way to do this in PureBasic? If so, I need a) a check if an email client is available and b) how to initiate an email containing one or multiple attachments. Important: The user must start the transfer by clicking the send-button, this must not happen automatically.
And wish #3: as easy as possible for an almost 60 year old beginner
Is there a way to send files via "send to"?
Re: Is there a way to send files via "send to"?
Here is a simple way, to start on Windows the standard email Client with some parameters :
Code: Select all
EmailAdress.s = "user@example.com"
Subject.s = "Message Title"
Body.s = "Message Content"
RunProgram("mailto:" + EmailAdress + "?subject=" + Subject + "&body=" + Body)
Re: Is there a way to send files via "send to"?
Not acctually answer to your question
But since vast majority of attachmemt are blocked nowdays and most people use "file send services" like box/onedrive etc
You may consider upload there and get link back . Which is also easy to copy it to message body to bisonte solution
But since vast majority of attachmemt are blocked nowdays and most people use "file send services" like box/onedrive etc
You may consider upload there and get link back . Which is also easy to copy it to message body to bisonte solution
Christos
Re: Is there a way to send files via "send to"?
Hi Bisonte,
thanks for your post. As I wrote in the headline I want to send files by email.
or more precisely "mailto" does not allow attachments.
The plan was that I could use the installed e-mail client without knowing which one it is and without having to ask the user for sensitive data (password, server, ...). I wanted to prepare an email completely with subject, body, attachment and the user only has to enter the recipient and send it.
The only thing that remains is to control the respective email client via "runprogram". No problem with Thunderbird but I have no experience with Outlook or other email clients and how to use command line parameters for them. I'm grateful for any help.
thanks for your post. As I wrote in the headline I want to send files by email.
Code: Select all
RunProgram("mailto:" + EmailAdress + "?subject=" + Subject + "&body=" + Body)
The plan was that I could use the installed e-mail client without knowing which one it is and without having to ask the user for sensitive data (password, server, ...). I wanted to prepare an email completely with subject, body, attachment and the user only has to enter the recipient and send it.
The only thing that remains is to control the respective email client via "runprogram". No problem with Thunderbird but I have no experience with Outlook or other email clients and how to use command line parameters for them. I'm grateful for any help.
Re: Is there a way to send files via "send to"?
Interesting info here about "mailto:" and attachments -> https://support.interact.technology/sup ... tachments-
Haven't tried it, but the author claims it's possible by using "mailto:" with a JSON config file that points to the file.
The short code there looks very simple to adapt to work with PureBasic.
Haven't tried it, but the author claims it's possible by using "mailto:" with a JSON config file that points to the file.
The short code there looks very simple to adapt to work with PureBasic.
Re: Is there a way to send files via "send to"?
I'am not sure how this can be done in PureBasic.
Found some Not-PureBasic codes which should do the trick using an IDataObject.
https://mvps.org/emorcillo/en/code/vb6/sendmail.shtml
https://www.codeproject.com/articles/38 ... -recipient
Helpful, because this is based on Shell Extension stuff
https://learn.microsoft.com/en-us/windo ... shell-exts
Happy coding and stay healthy.
Found some Not-PureBasic codes which should do the trick using an IDataObject.
https://mvps.org/emorcillo/en/code/vb6/sendmail.shtml
https://www.codeproject.com/articles/38 ... -recipient
Helpful, because this is based on Shell Extension stuff
https://learn.microsoft.com/en-us/windo ... shell-exts
Happy coding and stay healthy.
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home
Re: Is there a way to send files via "send to"?
maybe it is sound "Better" to crate a base64 attachment to a file but i believe a service like transfer.sh is by far easier and avoids antivirus tools
transfer.bat is from transfer.sh page at bottom (click more twice)
transfer.bat is from transfer.sh page at bottom (click more twice)
Code: Select all
path$ = "E:\Tools\Network\transfer.sh"
RunProgramResult = RunProgram("transfer.bat","test.txt >link.txt",path$)
Delay(3000)
If ReadFile(0, path$ + "link.txt") ; if the file could be read, we continue...
linkurl$ = ReadString(0)
CloseFile(0)
DeleteFile(path$ + "link.txt")
EndIf
RunProgram("mailto:" + "test@gmail.com" + "?subject=" + "File link from XYZ" + "&body=" + linkurl$)
Christos