I'm trying to create an applescript to use on outgoing email messages in Outlook 11 for Mac to dynamically set the email signature in the message based on who the sender address is. I have multiple accounts in Outlook, and would like to change the signature based on which one I'm using. Below is the code I've been trying, but have not had any success. Any advice?
tell application "Microsoft Outlook"
if message sender contains {name:"emailaddress"} then
set the message signature to signature {name:"signaturename"}
else
set the message signature to signature {name:"signaturename2"}
end if
end tell
If I understand your question, I think Outlook 2011 has this capability built in, without the need for any scripting.
Click "Outlook", then "Preferences..." from the Outlook menu
Click the "Signatures" icon
Set up the signatures you need if you haven't already done so, and give them meaningful names
Click the "Default Signatures..." button
Associate the relevant signature to each account that you require
There seems to be a bit of a trick to using this. If you want the signature for account X to appear automatically in a new message, then you must first select a folder from account X before creating a new message. If you do that, then the message should include the correct signature that you have set up for that account.
Related
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.
I'm working on an Outlook 2010 add-in that needs to prompt users before following a link found in an email. During the process I'd like to offer the user the choice to trust or block the sender of the email, thus I need to access both lists. I realize that Junk/Spam email options are not exposed by Outlook OM. Although I was successful in accomplishing the task using Redemption, unfortunately I'm not allowed to use it by my employer, so I need to find another way. I found this post (Get Safe sender list in Outlook 2007 C# Add in) that points in the direction of either MAPI properties or registry keys.
My preference would be MAPI props, but I'm not sure what object that property belongs to. Would it be the property of the default store?
Outlook.Store obj = Application.Session.DefaultStore;
const string PR_SPAM_TRUSTED_SENDERS_W =
"http://schemas.microsoft.com/mapi/proptag/0x001f0418";
Outlook.PropertyAccessor pa = obj.PropertyAccessor;
string list= pa.GetProperty(PR_SPAM_TRUSTED_SENDERS_W).ToString();
Unfortunately I'm getting an error message (translated to English) like 'Object doesn't have such property'. In production it would have to work with Outlook clients connected to Exchange 2007 mailboxes.
Ok found it. The actual property is called PidTagExtendedRuleMessageCondition and the Blob format is described here MS-OXCSPAM and in MS-OXORULE respectively.
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).
I have an email that I need to schedule to send later. I know you can schedule an apple script to fire off at a set time using iCal, but I have been unable to find one that works. It doesn't necessarily have to be done this way though. I would be grateful of a solution to this problem.
This works for me with a run script alarm in iCal on 10.6.8
tell application "Mail"
activate
set mymail to make new outgoing message at the beginning of outgoing messages with properties {subject:"Triggered"}
tell mymail
make new to recipient at beginning of to recipients with properties {address:"first#email.com, second#email.com"}
set content to "hi"
end tell
--show message window (otherwise it's hidden)
set visible of mymail to true
--bring Mail to front
activate
send mymail
end tell
I'm also getting an error like outgoing message 1 doesn’t understand the send message when trying to send an outgoing message. Referring to a message created from a script still seems to work though.
tell application "Mail"
set m to make new outgoing message with properties {subject:"subject", content:"content"}
tell m
make new to recipient at end of to recipients with properties {address:"jana#doe.com, john#doe.com"}
end tell
send m
end tell
You could also create a Calendar alarm in Automator.
I just accomplished this without Automator, using only Apple Mail:
Double-click anywhere your calendar to start creating an event.
Give the event a name. This will be the subject line of the email.
Set the date and time of the event to when you want the email to be sent.
If you want the email to be sent on a schedule, choose a repeat frequency and potential termination date.
For the alert, choose Custom....
Select email. You might be prompted to add a contact card to the Contacts app.
Choose the person to whom you want to send the email, and set the time to At Time Of Event. Press OK.
You can choose to add Notes, a URL, or attachments. I haven't tried these options, but I assume that they are carried forward in the email that is sent.
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.