How can I get who I am sending a message to? - macos

I'm trying to write an applescript which will append 'xxx' to the end of the message if I am sending it to my SO. Obviously I don't want to add 'xxx' on every message I send.
I've tried recipient, myBuddy and a few others that I've lost track of and none of them work.
my code is below:
using terms from application "Messages"
on message sent theMessage for theChat
// if recipient is THE MRS
set kisses to " xxx"
set myResponse to theMessage & kisses
return myResponse
end message sent
end using terms from

The on message sent event handler only returns the text of the message and a description (and type of message).
None of these contains the recipient, so you can not get who the message is being sent to. The best you can accomplish is text substitution, say, if you wanted any occurrence of xxx to substitute in for something else.
Remember you can set up text string autocomplete system-wide in System Preferences/Keyboard, to accomplish similar things.

Related

Office.Recipients (interface) getAsync returns empty instead of mail adresses

The "getAsync" function of the office recipient interface returns an empty result even if adresses has been added to the to/cc/bcc field.
When you enter a email address in the to / cc / bcc field and then you open the ScriptLab sample Add-In (Compose Message To), if you click on the "Get who this is to" button, an empty result is returned. The recipients are still not resolved as they should!
ScriptLab GetAsync
The only way to resolve the recipients is to click on Tab/Space or ";".
When the getAsync is call, all recipients should be resolved automatically.
Outlook caches values and doesn't propagate changes to the object model until the focus is moved to another field on the UI or the item is saved. This is a known issue when dealing with Outlook.
A possible workaround is to call the SaveAsync to get changes saved and then request new values. So, prior to getting recipients in the code you need to call the following method:
Office.context.mailbox.item.saveAsync()

How to read gmail inbox messages and extract the data from the email in a word/excel folder using UiPath?

I'm using gmail account to extract the data, from the body of the mail and I want to store that data in a word/excel folder.
Can someone explain the process to achieve this?
The email body would be like this:
Hello!
First name
John
Last name
Doe
Email
sample#gmail.com
Message
Text
You can read the email using the Get IMAP Mail Message activity and get the Body of Email in a Text then you can use the String manipulation/regex to find the required text and then store it in Excel/Word.
You may need to keep the following things in mind.
You will need to create an App Password by going to your Google Account Settings (https://myaccount.google.com/apppasswords) and use that Password in the Get Mail Message Activity.
To Get the Email Body the EmailMessage.Body property will not work instead you will need to use the EmailMessage.Headers("PlainText") Here EmailMessage is the Each Email Message from the list of Message. Here is the screenshot.
Above If condition is used to check if the Subject of Email which we want to read.
Once you get the Email Body in a String Variable you can use either String Manipulation or Regex to extract the required data from the body of the email and write to the excel or word.
Hope this helps.

How do i get body of message when using keyword mentions in teams

in automate i have a flow. I am using "When keywords are mentioned". the keyword i entered is "test"
I Selected, the team,channel,etc... all correctly.
when someone types "the test is a success". in that channel. how do i get the full string "the test is a success"?
I have tried a few operations "get Messages", also tried a few dynamic content options and a few triggeroutput variations. all either are blank or provide a long json string with subscription,channelId,teamId,etc. but not the string I am trying to get.
The Get message details action should help you ...
In the body of the response, you'll clearly see the text that was entered to invoke the trigger.
Use Get message details, you will get message detail of that reply message. Then get your text with expression like this:
outputs('Get_message_details')?['body']['body']['plainTextContent']

Microsoft graph API - empty bccRecipients list

This is the Scenario:
In the same Azure tenant, I used one account (user_1_address) to send emails to the other account (user_2_address) using outlook (o365).
I sent 3 emails, one where user_2_address is BCCed, one CCed, and one when it's the TO recipient.
I'm using Microsoft graph API to get a list of emails received by user_2_address in a specific time range, using this query:
https://graph.microsoft.com/v1.0/users/{<user_2_id>}/messages?$filter=
receivedDateTime ge <some date> and receivedDateTime lt <some other date>
and isDraft eq false
and sender/emailAddress/address ne '<user_2_address>'
I'm getting all the three emails user_2_address had received from user_1_address. But in the email user_2 was BCCed the bccRecipients list is empty, when it should contain user_2_address :(
I have seen this question about sending an email from Gmail and BCC an outlook user:
Microsoft graph API: empty BCC field
In that case, also the bccRecipients list was empty, but it was resolved by saying the BCC is removed when sending the emails from an external source (Gmail in that case). When for me it's not an external source - both users are using outlook in the same tenant.
So my questions are:
Is it the desired behaviour, or is it a bug?
Now, let's say I'm using the query above where I get all emails where the sender is not the user_2_address and it's not a draft. Can I assume that every email I get where user_2_address is not in the ccRecipients and toRecipients lists - that email was BCCed to user_2_address?
Thanks!
The bcc field in a Message is an envelope (P1) recipient only so you should always expect that it will be blank (no matter the context inside a tenant really make no difference). Like the other post referenced if it wasn't blank it would break the RFC and the purpose of a BCC, the only exception is the sent item (which is just a copy of the sent message)
No there are many scenarios that would break that particular logic eg forwarded email is one the comes to mind. You could certainly refine you result set that way, one thing you might want to examine is the X-MS-Exchange-Organization-Recipient-P2-Type: mail header that should get set in your internal to internal scenario (you need to look at the PidTagTransportMessageHeaders extended property to see it)

Ruby Net::SMTP - Send email with bcc: recipients

I would like to use Ruby Net::SMTP to send email. The routine
send_message( msgstr, from_addr, *to_addrs )
works well in my code for sending email, but it is not clear from this API how to send email to a list of people that need to be blind copied (bcc:).
Am I missing something, or is it just not possible with Net::SMTP?
The to_addrs parameter of send_message specifies the envelope to addresses. Including an address in to_addrs has no effect on the to and cc addresses that get included in the message header.
To bcc a recipient, include the address in the to_addrs parameter, but don't include it in the headers in msgstr. For example:
msgstr = <<EOF
From: from#example.org
To: to#example.org
Cc: cc#example.org
Subject: Test BCC
This is a test message.
EOF
Net::SMTP.start(smtp_server, 25) do |smtp|
smtp.send_message msgstr, 'from#example.org',
'to#example.org', 'cc#example.org', 'bcc#example.org'
end
This will send an email to three recipients: to#example.org, cc#example.org and bcc#example.org. Only to#example.org and cc#example.org will be visible in the received message.
Yes it's not possible easily with Net::STMP. But there are a really great gem to manage your email sending (http://github.com/mikel/mail). I encourage you to use it.

Resources