Logic Apps Email Trigger - Get original Alias - outlook

Found a very similar question here: Email aliases not returned as "To" address in logic app
TLDR: From within a logic app "When a new email arrives" trigger, How do I get the original alias that the email was sent to?
I have a logic app that creates a ticket based off an email sent to an outlook box. Now I want to be able to choose aspects of the ticket based off of whether or not the email was sent to the mailbox itself or an alias of the mailbox. The problem I'm having is that by the time logic apps gets a hold of the email, the alias address has already been replaced with the actual box's address ("alias1#place.com" -> "actualbox#place.com").
The actual mail in the inbox has the original email's alias information in the headers, but I can only get them by looking at the properties in outlook. I've tried to get the original "To" internetheader information both within logic apps (by exporting the email to blob storage and looking at headers there) and with the Microsoft Graph API. Sadly, the email exported by logic apps doesn't have the alias information and Graph API has pretty much every header but "To". At least one other person has lamented the lack of To
That said, the actual email still has the original alias information. Can someone help me get that information in logic apps without jumping through too many hoops? A many hoop solution is welcome if none other can be found though.

Use the Export email (V2) action from the Office 365 Outlook connector. This will give you the full message with original headers (including the actual To address)!
The flow here is, trigger on the incoming email, as you already are, then add the export email action providing the message id from that trigger to pull this specific email.
From there, you you'll have one big "body" property which you'll need to interrogate to find the To address.
Caveat on this though, it doesn't work when emails are sent between mailboxes in the same Office 365 tenant. Exchange Online will "helpfully" go, "I know that address... this is the address you wanted!"

What API are you using? In Outlook Object Model / MAPI / EWS, you need to retrieve the PR_TRANSPORT_MESSAGE_HEADERS MAPI property (DASL name http://schemas.microsoft.com/mapi/proptag/0x007D001F)

We arrived at a many hoop solution.
The "Primary" email box now has some rules that look at the internet headers mentioned above (Message -> Properties -> look for 'To:').
If it finds an alias there, it will put the email in a corresponding folder for each alias.
Then we have logic apps listening to each of the alias folders which will then send the email's information to the _Core logic app that does the actual processing.

Related

How can I replace the originating e-mail adress in Azure Api Management Service?

In Api Management Service, when someone subscribes to an Api, they gey a mail from a no-reply address. By default, this mail is something like "apim-noreply#mail.windowsazure.com", I changed this in de settings to "no-reply#myorganization.com".
But now when a user receives an email, both these addresses are listed as the sender address. How do I fix it to only display my custom address and remove the default one (circled in red)?
I tried looking in the mail templates to see if it was present there, but it wasn't.
I tried finding a solution in Microsoft documentation but couldn't find anything.
I understand that you wanted to change the "Mailfrom" header to a value of your choice. Currently it is not possible. The "MailFrom" header contains information about the actual sender of the email since APIM sends the mail you will not be able to remove apim-noreply#mail.windowsazure.com due to security issues.

Logic apps against EOL Shared MBx

I am VERY new to Azure Logic apps. Please be gentle - but any links to sources of learning will be appreciated as well.
I have a made a simple logic app at the request of the business that answers every e-mail received in a shared mailbox with an autoreply - instead of the standard "one per customer" action of the normal Exchange Online autoresponder.That part works just fine.
We now need to add an action that can delete without replying for specific senders. Why? We "found" another org that must be set up to do the same thing, thus causing a flood of responses between the two org's Autoresponders. Not surprising, but obviously not good.
I'd like to be able to add the relevant address (and be able to add addresses in the future) to a (parallel?) filter, that would prevent this loop from happening. I've tried my best to use the "Delete Email (V2)" built in function for "Office 365 Outlook" but it always ends in a "Resource Not Found (status code: 400)" error and the email isn't deleted/moved to the deleted items folder.
Any ideas how to either get this to work, or a better way to do this job?
Thanks,
Mule
I have a made a simple logic app at the request of the business that answers every e-mail received in a shared mailbox with an autoreply - instead of the standard "one per customer" action of the normal Exchange Online autoresponder.That part works just fine.
As mentioned in this statement, we understood that you are using When a new email arrives (V3) trigger to give an auto reply.
I've tried my best to use the "Delete Email (V2)" built in function for "Office 365 Outlook" but it always ends in a "Resource Not Found (status code: 400)" error and the email isn't deleted/moved to the deleted items folder.
To make this work you just need to give the message id from the trigger When a new email arrives (V3) and so it deletes the one that has already arrived. You can make required actions in between before deleting the mail.
Considering this to be my logic app
I could able to get the email content to my logic app from outlook in Get email (V2) step and as soon as it completes this action the Delete email (V2) executes and deletes the one that just arrived.
Here is the email that I'm receiving
and the successful run for my logic app
For more information on logic apps you can refer Introduction to Azure Logic Apps - Learn and Azure Logic Apps documentation
REFERENCES:
Office 365 Outlook - Connectors
Ultimately a better answer was to use different variable for the conditional. Using an OR conditional with several archetypical subject lines, as well as embedding "invisible text" in the body of the original response email was the solution, as Logic Apps seems incapable of pulling the Message ID through the steps.
Thanks for your help #swerhakandikonda.

How do I verify an email address is real and in use using the Sender Policy Framework

From what I've been reading the SPF can be used to validate email addresses by sending commands (rather than an actual email) such as HELO. I've managed to pick up a basic grasp of the policy but I can't get my head around how I'd go about solving the following problem:
I've got a number of email addresses attached to contacts in a CRM system and I'd like to find out if the email addresses are valid and still in use.
Currently we're using a REST Web Service (http://emailinspector.co.uk/) which returns "Ok" (if its ok... duh), "Bad" (if its not valid or not in use) or "Unknown". For Unknown, you are also provided some notes on why it came back with that, i.e. you are told if the Mailbox is full or if its a well known DEA.
I'd like to be able to program a script that can replicate this functionality and from what I've worked out it should use the Sender Policy Framework to do this? The problem is I don't know how I'd go about returning such precise information for "Unknown" email addresses.
Ideas and thoughts?
Actually SPF is just a text record, with some "hints" to let you know if an IP address or mail server is "allowed/Authorized" to send email for that domain. It doesn't tell you anything about an individual email address in that domain..
for example
[doon#qix:~] host -t txt labratsoftware.com
labratsoftware.com descriptive text "v=spf1 a -all"
The SPF record for one of my domains says that only the a record for the domain is authorized to send email for labratsoftware.com, and that if it doesn't come from that IP then it should be rejected (-all).
So the best you can do with SPF is tell that a received email came from an authorized host, and then use that information to help decide if you want to reject it or not.
The best way To test the validity of an email address you have, is to email it, and see if it bounces. You can use options like VERP (http://en.wikipedia.org/wiki/Variable_envelope_return_path) to automate the bounce handling. You can also try and connect to the MX records listed for the domain and try to deliver a message that way. Some Mail servers support verify (But most admins disable this to prevent information leakage). You can use RCPT TO to see if the server accepts it, but even if it does , you have no way of knowing if it will actually make it to their INBOX. My guess is that is what the API you are currently using is doing. And unknown are just ones that either don't answer, greylist, etc.

How does the CRM Email router set the RegardingObjectId on incoming emails

We have a system setup where complaints from a website form are emailed to an address and subsequently picked up by the email router and placed in a queue. Users then create a case from these emails (custom code create the case and populates it based on the email content and the queue it arrived into)
Some of the emails are coming in and the regarding object is set to an existing case even though the email and the case are not related. My guess is that this is something to do with the fact that the emails are coming into the queue from the same web address (complaints#abc.com)
Can somebody explain to me the criteria the email router uses for setting the regarding object of an incoming email
Thanks,
Neil
Looks like you are another "victim" of a feature called Smart Matching. For info on what that is and how to disable it, look here.

Changing the sender of a Dynamics CRM e-mail in a plugin?

So, here's my situation. We have a department that needs the ability to use queues in CRM 4. They also need the ability to reply to e-mails that come to that queue from their department e-mail address. (So that any customer responses will go back to the queue to be handled by agents)
I originally was going to build a JavaScript customization that inserted a checkbox that said "Send From Business Unit". Toggling this would look up their department user based on the e-mail address on the Business Unit. I successfully got this working (as a concept), but found that actually sending triggers the dreaded "CrmCheckPrivilege failed."
Which is good, because that means CRM is actually enforcing security.
So my problem? I have no idea how to replicate this functionality and it's a must have for this customer group. Is there anyway to modify the e-mail after it's already gone through security checks via a plugin? Perhaps a pre-stage send plugin?
I want to be reasonably certain of success before I commit a lot of time to this solution. I'm also open to any other ideas too.
Thanks in advance,
Clif
Well, first, a "CrmPrivilegeCheck failed" can always be fixed by adjusting the user's roles and giving him the appropriate privilege (the privilegeId is always returned in the exception but may not be shown in the particular error dialog you are getting) and level, but this may not be wanted by the department.
A solution we have used is just slightly different from yours: Do not send the mails through another user, but through the queue. Queues can also be eMail senders in MSCRM. The queues should already have the correct eMail addresses set in order to work properly with the eMail router. Set up a way to determine the correct queue (like a field on the systemuser entity or a hardcoded queue name in your JavaScript) and set the from lookup accordingly in your JavaScript. That way the eMails will be sent using the name and address of the queue, so any direct replies will always have that queue as the recipient.

Resources