How do I set the default sending email account in mail.app using AppleScript? - 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).

Related

create a slack message and edit before sending

I have created a bot using Botkit and am working on creating an interactive message. What I want to do is when the user clicks on the button in the interactive message, a new message will be created pulling som info from the original interactive message, BUT WILL NOT BE SENT. I need to continue editing the message before choosing to send it. Does anybody know whether this is possible or not? I have been googling and searching slack's docs and botkit's docs, but haven't been able to find an answer.
If you want to let the user edit a message before sending you can use the Dialog feature from Slack. It will allow you to show an input text field, where the user can make his edits. I am not familiar with Botkit though and can not say if it supports Dialogs.

Outlook New Message - Text Area Below Toolbar

I am creating an addin for Outlook.
I want to check some text on sending, but im not sure how to reference it
The text is in the image below and says “Attachment will be sent using...”
If the text equals the text displayed, i want to do something.
Thanks for any advice.
The Outlook object model doesn't provide anything for reading mail tips. But you may consider using EWS for getting mail tips. See Using MailTips in EWS to get the OOF (Out of Office) Status of users with C# and Powershell for the sample code.
FYI MailTips are informative messages displayed to users in the infobar in Outlook Web App and Outlook 2010/2013/2016 when a user does any of the following while composing an e-mail message:
Add a recipient
Add an attachment
Reply or Reply all
Open a message from the Drafts folder that's already addressed to recipients
To configure MailTips for mailboxes, external contacts, and distribution groups, in the Exchange Control Panel, select the mailbox, external contact, or distribution group, click Details, and then in the MailTip section, create the MailTip.
To configure MailTips for mail users and dynamic distribution groups, in Windows PowerShell, use the MailTip parameter on the Set-MailUser and Set-DynamicDistributionGroup cmdlets.
Regardless of whether you use the Exchange Control Panel or Windows PowerShell, two things always happen when you add a MailTip to a recipient:
HTML tags are automatically added to the text. For example, if you enter the following text: This mailbox is not monitored. The MailTip automatically becomes the following: <html><body>This mailbox is not monitored.</body></html>
The text is automatically added to the MailTipTranslations property as the default value. If you modify the MailTip text, the default value is automatically updated in the MailTipTranslations property.
Read more about that in the Configure MailTips article.

How can a predefined email be opened with the default email program in 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?

Can outlook (web) notify me that I have email?

I have two email accounts. One of them I use every day. The other one, I have to fire up a VPN, authenticate through a firewall, and then run Outlook Web Access. Triple-yuck.
I'd like to set up a rule that says "Whenever I receive an email to annoyingaccount#company.com, send an email to mydailyaccount#myworkplace.com letting me know to check annoyingaccount." I do not want am not allowed to forward the actual email to mydailyaccount. I simply want a notice that email is waiting for me.
I see options that will let me forward the email or send a text message, but I don't see an option to just send a boilerplate email. Is there something I'm missing, or a "trick" I need to do, or am I just out of luck?
There is not an option like this in the Rules Wizard.
You can forward the email to your account and use rules to:
File the AnnoyingAccount email in a folder (so it is out of the way)
Display an a custom message in your MyDailyAccount email.
Take a look at the the display a specific message in the New Item Alert window option found on the 2nd screen of the Rules Wizard.
Here is a quick How To:
http://www.howto-outlook.com/howto/newmailalert.htm

Can I override the default "Drag and Drop" behaviour when dragging email item from outlook?

After dragging email item from outlook, my own application (written in C#) can get the data and retrieve the msg data when the email item is dropped on it. But is it possible to override the default "drag and drop" behavior so that I can send some information else (rather than the default information) when dragging an email item and pick up the information when the item is dropped on my own application?
No - there might be some very ugly hacks, but no usable approach.
What you could do though is utilize something from the mail in information you receive via Drag'n'Drop as a unique identifier somewhere in the mail information that gets transmitted.
With the ability to identify the mail in Outlook you could e.g. connect to Outlook via automation or use a minimal Outlook AddIn that can be queried for what you need.

Resources