How can a predefined email be opened with the default email program in Windows? - windows

I'm searching for a possibility to generate a predefined mail when the user clicks on a button in a tcl/Tk program. Up to now I'm using the mailto-protocol, but as the predefined message may have a long body, the message may be cut at some point. Thus, this is no real solution.
All alternatives I found up to now have some drawbacks. So, is there a possibility which meets following requests?
Open default mail program, which may be a proprietary one (not only the standard ones like Outlook or Thunderbird...)
Create (and open) predefined message with either much text or alternatively an attachment
Should work on at least Windows XP until current versions (Windows 10) and also with very limited user rights
Must be possible to implement with tcl or C
It would be no solution to just send a Mail in the background, as it should be really transparent what happens and which information is send...
(I know there are already many questions about similar topics, but I haven't found a solution which worked for me.)

It should be possible to automate sending mails on Windows via tcom by using the CDO.Message COM object.
That's a Windows-only solution.
A cross-platform solution which should work everywhere is using the package mime to construct the message and smtp to send it. Both are part of "the standard Tcl library", tcllib, available on any sensible system which has Tcl packaged.
As to
It would be no solution to just send a Mail in the background, as it should be really transparent what happens and which information is send...
I failed to parse it. Could you may be try to reformulate?
Update:
Well, OK, after re-reading the title I think I completely fail to understand the essense of the question.
If everything what's needed is opening a e-mail message — as in "a file with MIME-formatted text representing an e-mail message", — I think that's hardly possible because a "default program to handle e-mails" is specified for URIs having the mailto scheme.
If what's needed is to spawn a default mail client on Windows asking it to open a window to let the use compose an e-mail message destined to the predefined address, the you can use
exec [list rundll32.exe uri.dll,FileProtocolHandler "malto:$addr"]
where the addr variable contains the recipient's e-mail address.
The mailto: URIs allow specifying the message body (and may be that's what you're currently using) but they (rightfully) do not allow specifying a file name to interpret as a message, so there appears to be no way to open a mail client with a pre-made message.
Update #2:
OK, so may be I finally got what did you mean by saying "should be really transparent...". You mean the user has to see with their own eyes what will be sent, right? But what's wrong with just emulating an e-mail client by presenting the user with a dialog window showing which will be sent? This is used by every software product I have seen which had a similar feature. Various Microsoft and Mozilla products come to mind as the most visible examples. They just offer you a dialog box to browse what will be sent.
Note that even if the user saw "what will be sent" in a true mail client and hit "Send" with their own hand, nothing prevents any host among those which will be handling this message (usually two at least) from modifying it unless it was a cryptographically signed message (in S/MIME format).
Are you sure you want to go that far?

Related

Is there a way to open up a known Outlook email through Java 11? (Web or Local)

Short Version:
I want to open any specific Outlook email from my Java app, either locally through the Outlook app or through the website on a browser. I already have the email information like folder, message ID, UID, sender, receiver, etc but not the email ID used in the URL of the Outlook website. Does anyone know of a way to do either of these things through Java?
Long Version:
I'm creating a software for my company in Java that has a built-in email client for Outlook emails so the emails can be linked with jobs in various ways. So far I've been able to make good progress with the email client section in terms of displaying a list of emails and being able to display a chosen email, but recently I've realized creating a GUI for an email editor (keeping track of reply chains, dragging in images for inline attachments, etc) is quite the gargantuan task to do on my own(JavaFX's HTML Editor could use a lot of work).
My band-aid solution for now is to have my program open the chosen email up through either:
Some (Windows 10) system command by calling the Outlook desktop application to show the email by some sort of ID (maybe UID?). I know on some level that this is possible because our company has an old program written in C# that can indeed do that.
Opening up the system's default browser with a link to "https://outlook.office365.com/mail/folder_name/id/insert_id_here". This is my preferred solution.
Here are my problems with each option so far:
There doesn't seem to be any resource I could find that provides an answer to this. The closest I can find are threads that explain how to open the default mail application with options to pre-populate to/from/subject/body sections (not to mention you can't pre-populate the body with anything besides text! So much for reply/forward messages with HTML formatting and attachments!). Another problem is that the old program I mentioned displays emails by finding the Outlook application's files (presumably the local OST file). I have no idea how the old program's able to call Outlook to show emails and even then, there's a chance that there's no Java equivalent. I, however, am using JavaMail to load up my mail, as I think it's better to talk to the Outlook mail server to fetch/push mail updates rather than wait for the Outlook app to sync up. This creates a problem because even if I knew how to call Outlook, my application may be more up to date than the Outlook app (especially if Outlook is not already open) and if call before Outlook updates, Outlook wouldn't be able to show it.
Again, I can't seem to find a resource for explaining these URL IDs. They're not the same as the mail's UIDs, and they don't seem to be anywhere in the mail's contents when grabbing mail through JavaMail. The most I was able to get from research was that they were called "long IDs", as they were just long strings (seemingly non-sequential) but that might've just been a made-up name from the article as I've found no other references to it. There's a chance that they could be some sort of encoded UID but I didn't see any note of JavaMail having to decrypt to get UIDs in the documentation. I doubt I'd be able to make any more progress with this option, but if there's a solution similar to this (perhaps some sort of script that opens up Outlook online, searches by some identifier, like body contents, and pulls up the first result? Idk much about browser scripts) I'd be happy to hear it.

Receiving messages back to my platform

Use Case SMS leaves my platform and goes out to a receiver (SMS). I would like to attach some sort of custom identifier so when the user responds back to the SMS..and my platform received the message..I know how to internally route the response back in my platform.
Any ideas?
Maybe set up a system where when the code is sent out
For instance:
Code - 11832
The user then has to enter this code on your website. A program will then match to see if it's the identical code. So you are then able to log the information
No expert on this though and Where is your code ?
Twilio evangelist here.
There isn't really a great way to attach an identifier to the message itself. You could force the user to prepend/append a code in their reply, but depending on your specific scenario that might not be a great user experience.
Another option is to save the to/from phone number as a unique pair when you send the message. Then as your application receives replies you can check the incoming to/from phone number against what you saved.
Hope that helps.

TNEF capable e-mail clients

We have written an Outlook Add-in and it appears that when you add user properties to a MailObject while the user is composing it, and you then encrypt and sign it and the message is Sent, the message will end up getting sent as TNEF, despite imploring outlook to do otherwise through various settings and so on as described here: http://www.slipstick.com/problems/outlook-is-sending-winmail-dat-attachments/
So one of our clients has a contact who insists on encrypted communication and therefore our client now has an issue with this contact. Either they cannot use our Add-in to its full potential (having to avoid the functionality that adds those User Properties), or their contact complains about receiving mail with "winmail.dat" attachments.
I have since established a communication with our client's contact, and I am trying to establish what e-mail client they are using, and one thing I'm going to try is see whether they would be open to the idea of moving to another e-mail client that is TNEF capable, even if it's not Outlook. But my Google-Fu is failing me. I've googled "TNEF capable email clients" and many variations thereof "that can use" "able to" ... etc etc etc. Nothing gives me the result I am looking for, a simple list of non-outlook email clients that have native capability for handling TNEF e-mails they receive. Plenty of articles of tools to allow users to decode the winmail.dat attachments manually, sure, but no simple list of natively capable e-mail clients.
If anybody can help me with this one, it would be greatly appreciated.
Eudora used to support TNEF. Otherwise Outlook is the only one to the best of my knowledge.

run a script or sanity check against outgoing emails in outlook 2010

Is there a way to setup Outlook 2010 to run a script or some other form of sanity-check when you attempt to SEND messages from the client? My specific situation is that I use the same outlook client for multiple accounts (work, gmail, VPS server, etc) and I've found myself a couple of times sending emails "from" the wrong account.
In a perfect world I'd want to be able to write a script with logic something like the following:
when (I hit send)
if (the "source" account is "myuserid#gmail.com") then
if (there are addresses in TO or CC that match "work.com") then
pop up a dialog box that says:
"You appear to be sending email to work.com from gmail.com - do you really want to do this?"
if yes, then send it and return
if no, go back to the message compose window
that way, I'd have to actually very intentionally use a non-work email address to send email to the work people (which is rare in my particular case)
Try SendUsingAccount to read the "source" account in ItemSend.

How do I set the default sending email account in mail.app using AppleScript?

I'd like to use Control Plane to change the default sending account in mail.app (preferences->composing->send new messages from) when I switch from a work to a home environment. Control Plane doesn't have an option to do this, and I can't find anything in the mail.app AppleScript dictionary that might work … except, perhaps, "default email account", but that is r/o. Any ideas on ways to do this? I know I can do this message by message, but I want to change the default.
To set the default sending address, you can change the value of the Send new messages from: dropdown list in the Mail.app preferences window under the 'Composing' tab.
If you want to use AppleScript to change the sender once you're composing a message, that can be done using AppleScript as described in this question and answer.
In the Composing tab, you can choose to send new messages from the account of the selected mail box. You'll find out that this is sufficient in most cases. There is no way to automate this with AS afaik, except perhaps with GUI scripting.
(I agree that this question doesn't really belong on Stackoverflow).

Resources