I'm trying to use Microsoft Graph to get the original email address a message was sent to if it ends up there via BCC.
We're using MSGraph to get emails sent to a shared email inbox in the form of "AppInbox-1234#example.org", where "AppInbox" is the name of the shared inbox and "1234" is an id we use in the app. We have a rule that already moves the email to the shared "AppInbox", which in turn fires off our subscription that looks at the recipients and uses the ID to store contents the message.
This works great if the email address is in the "To" or "CC" fields. But if the email address is the "BCC" field, I can see the email itself, but not the address it was originally sent to (e.g. "AppInbox-1234#example.org"), which I would need for the ID.
When I look at the message itself I only see the empty collection
"bccRecipients": [],
The best lead I've had seems to be around ExtendedProperties, but I haven't been able to figure out how to get the original recipient.
Related
I would like to send several dems to an e-mail address with different customizations based on the information present in a Custom Object.
Es.
Email Address = xxx#x.com
Custom Object:
3 records with different information to be printed in the email to be sent.
Is there a way to ensure that multiple emails can be sent to an email address simultaneously with different customizations?
Is there a workaround for last created field merge etc?
Yes.
Create a dynamic for each demo, create decision steps on the canvas which check to see if the field in the cdo has the correct value, if not pass it to the next decision step.. if yes, pass it to the email which passes to the next decision step, like this:
Multi step campaign canvas example
Is there a way to get the email aliases address to which an email was originally sent from Microsoft Graph?
We have a single email account like main#company.com along with the multiple other associated email addresses (email aliases). Emails send to any of the aliases go to a to the same inbox as main#company.com.
If we send an email to alias#company.com and look at the message using https://graph.microsoft.com/v1.0/me/messages, it shows mail#company.com as the email address. We need to detect if it was sent to alias#company.com.
The information for the allies can be found in the email header and there is a potential workaround in the Outlook API:
https://outlook.office.com/api/v2.0/me/mailfolders/inbox/messages/{messageId}?$select=Subject,SingleValueExtendedProperties &$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x7D')
This returns an unstructured result which needs to be parsed and it is not very convenient. We are looking if there is a more direct way to get this from Microsoft Graph.
You can use the same $filter with Microsoft Graph. You simply need to switch PropertyId to simply id:
?$select=subject&$expand=singleValueExtendedProperties($filter=id eq 'String 0x7D')
Also note that don't need to both select and expand the singleValueExtendedProperties collection. Expanding will ensure it gets included.
I have two issues. Email verification works well, but I want to customize the email sent to users. Here is the content of the email:
Hello from Localhost!
You're receiving this e-mail because user test has given yours as an
e-mail address to connect their account.
To confirm this is correct, go to
http://127.0.0.1:8000/rest-auth/registration/account-confirm-email/MTE:1h4DCn:JtkrZ1wkENQIdG8ysIVu7Qx_R44/
Thank you from Localhost! https://localhost:8000/
How can I create an html file and fill in the content that I want to be sent in the email? And how about the email subject?
The second issue, is that when I click on the link, the user gets verrified, but then I get a 404 error on /accounts/profile.
Here is my code:
from allauth.account.views import confirm_email
urlpatterns = [
path('accounts/', include('allauth.urls')),
path('rest-auth/', include('rest_auth.urls')),
url(r'^rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', confirm_email),
path('rest-auth/registration/', include('rest_auth.registration.urls')),
]
Do I have to add a url for accounts/profile/ and create an html template showing that the email verification was successful? Also, is there a way to change to url to i.e accounts/verification-success/?
Custom e-mail
You can find the default e-mail templates used here: https://github.com/pennersr/django-allauth/tree/master/allauth/templates/account/email
Subject: email_confirmation_subject.txt
Text e-mail: email_confirmation_message.txt
You can override them in your Django app like any other template.
To activate HTML, you just have to add your own file with the name email_confirmation_message.html.
You can also have different messages when you signup or just confirm an e-mail address.
You can have a look into the code to understand how it works.
accounts/profile/
When you end up here you have successfully logged in. However, you will need to implement a view for this URL yourself, as whatever is to be displayed here is project specific. You can also decide to redirect elsewhere:
https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url
From https://django-allauth.readthedocs.io/en/latest/faq.html#when-i-attempt-to-login-i-run-into-a-404-on-accounts-profile
Since you have to implement the profile yourself, you can use accounts/verification-success/, too.
Users can receive an email that is sent to a list of people. They are given a warning that they can unsubscribe from this listing at any time. The user can Reply All which will be sent back to the server and resent to everyone else. However, the footer still remains in their reply.
I am using ActionMailer to send the emails. They are multipart HTML emails.
What is the easiest way to strip this information? Ideally, I would want it so that any part of the reply message is not built into the message part.
Edit: More information
Think of this as a support ticketing. I would only want to create a new record containing the reply information instead of the chain of replies already in the ticket. For example, if the first email sent has "i need help!", the second reply would contain, "help with what?". The third reply would be "i dunno... i'm bored".
The ticket model would have three records:
Record 1
id = 1
message = "i need help!"
Record 2
id = 2
message = "help with what?"
Record 3
id = 3
message = "i dunno... i'm bored"
edit
doc = Nokogiri::HTML(message.html_part.body.decoded)
doc.xpath("//blockquote").remove
I was able to strip the contents by using a as part of the message. However, the issue that I'm having now is below. Various email clients will add their own line of reply. For example, Outlook adds this.
Gmail adds this
Since these items will be included in the new stripping of the blockquote, how can i parse this part of the reply out as well to prevent having a garbled ticket record with junk data.
The way I have understood idempotency thus far is basically: If I send 10 identical PUTs to a server the resulting additional resources created will be identical to if I had sent a single PUT statement.
What I take this to mean is that the following implementation would adhere to this:
[AcceptVerbs(HttpVerbs.Put)]
ContentResult User(){
//parse XML that was sent to get User info
//User has an e-mail address which is unique to the system
//create a new user in the system only if one for this e-mail address does not exist
return Content(something, "text/xml");
}
There now if I sent 10 PUTs with XML for User data and they all contain the same e-mail address, only one user will be created.
However, what if they send 10 requests (for whatever reason) and they are all different, but the e-mail is the same. If the first request doesn't make it through then the data of the 2nd request will be used to create the user, and the following 8 requests will be ignored. Is there a flaw here? Or should I literally only ignore requests that are explicitly identical in every way and instead send back an error saying the user already exists if they use the same e-mail address?
Also, what kind of response should be sent from a such PUT statement? Info about the user? Maybe an ID to manipulate them with other API calls? Or perhaps it should just say "success" or "fail: [error details]"?
Your question doesn't reveal the URL where the PUT request is sent to. This is actually very important as it is not the email address within the XML data that dictates whether a new resource is created or an old one updated but the URL that you are sending the request to.
So, if you send PUT to /users/jonh.doe#foo.com/ it either creates the user john.doe#foo.com or updates it if it was already in the system.
Similaraly, if you send PUT to /users/123/ (using id instead of email) it will create or update user 123. However, in this case if the email has to be unique and somebody sends PUT /users/456/ and within that XML is the same email as what the user 123 already has, you have to respond with 409 Conflict.
If the user already exists with the same email address, then the 2nd and subsequent PUT operations should update the data for that resource. The success or failure should be communicated in the status code. If the update succeeds, respond with "200 OK", or "204 No Content"; you can return some information, but don't expect caches to store it as if it were the new representation you would obtain from a GET. If you do not intend for that resource to ever accept a PUT operation other than the first one, then respond instead with "405 Method Not Allowed", with an explanation in the response body. Use "409 Conflict" (again, with an explanation in the response body) if the submitted representation might replace the resource, but can't because it's particular fields cannot be reconciled with the existing state.