How to send nested attachments? - microsoft-graph-api

Stuck here writing JS code to send out an email via REST within a custom Outlook add-in.
Scenario is following
report
\
\---- another message (item attachment)
\
\------- attachment (file attachment)
In words, I am sending a new report message which includes another message as an Item Attachment (that works fine).
But now, the problem is that, when sending with another message that has attachments, then this fails. Opening the report which has the other message attached doesn't show the attachments.
Query is POST https://outlook.office365.com/api/v2.0/me/sendmail
Returns 202 Accepted
Body is quite long and on this Gist
https://gist.github.com/binarykitchen/2b95331c5c85e7cb4ca6f6917dc67a67
You can see Message has Attachments which has an Item Attachment (attaching another message) which has one file attachment called "bat_kitten.jpeg"
How come this sent message doesn't have this file attachment but server still responds with accepted 202?
Maybe some parameters are wrong? Not sure what to set for ContentId and ContentLocation for that file attachment?
Or are nested attachments not supported yet?
Any clues would be very much appreciated.

Related

Get Last Email Content From Graph Message

I am wanting to get just the most recent message from an email using Graph. So I don't want the whole email chain, just the body or text content of the most recent email. Is this possible without HTML parsing?
thanks
If you use the UniqueBody property https://learn.microsoft.com/en-au/graph/api/resources/message?view=graph-rest-1.0 that should contain what your after eg
https://graph.microsoft.com/v1.0/me/messages?select=subject,receivedDateTime,conversationid,uniquebody

How can I determine the original message of a reply?

Using Microsoft Graph, how can I determine which message an outgoing message is a reply to?
The internetMessageHeaders property is not available for items in the Sent Items folder of mailboxes (using the Graph API, at least -- they are available using EWS or IMAP). If it were, I'd look for the in-reply-to header. In the absence of this, is there something in the standard Graph message properties that will tell me this?
You can check the "Subject" or "bodyPreview" to check if the content contains "RE:", if the answer is yes, the message is reply to.
You can group the message by conversationId and then order by lastModifiedDateTime. This way can check if the message is the original one, if it is not ,it will be reply-to/follow-up one.
Get the message list first(/me/messages or /users/{id | userPrincipalName}/messages and so on), and then foreach the message id to call reply api(/users/{id | userPrincipalName}/messages/{id}/reply and so on). The result in the reply is a reply to.
To Test this, you can use the Graph Explorer first and then paste the JSON to a JSON viewer tool. For further use, you need to use net/java and so on to handle.
API reference: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/message
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/message_reply

MailCore2 - Fetch message content without downloading images or attachments?

I want to provide a preview of a user's messages, but I don't wish to download attachments just in order to do that.
The information I need is:
Subject
Date
Sender information (display name if available, email address)
Plain-text message
By calling the method fetchMessagesByNumberOperationWithFolder: with request kind MCOIMAPMessagesRequestKindHeaders, I get the date and subject, but it's very slow to return if any of the messages have attachments. By calling it with request kind MCOIMAPMessagesRequestKindUid, it returns very quickly, with just the Uid (and the current date, as a placeholder). From there, I still need to get the subject, the date and the sender.
Now I'm still trying to get this information, while avoiding downloading message attachments.
Calling fetchParsedMessageOperationWithFolder: or fetchMessageOperationWithFolder: both download the message with attachments, and are thus very slow to return.
Because fetchMessageOperationWithFolder: completes with a NSData object, checking the size of the given object reveals it to be the size of a regular message, plus its' attachment.
What can I do to get the information I need, without downloading any attachments?
EDIT: Calling requiredPartsForRendering could give me the content of the email, but in order to retrieve the Date and sender information, I'd still have to have a request kind of MCOIMAPMessagesRequestKindHeaders, which would download the attachment.
So to clarify:
I want to get the following information from an IMAP email, without downloading the email attachments:
Subject
Date
Sender information (display name if available, email address)
Plain-text message
The following methods should be helpful to you:
-[MCOAbstractMessage requiredPartsForRendering] will return the message parts that you needs to fetch to be able to show the text content of the message.
-[MCOIMAPSession fetchMessageAttachmentOperationWithFolder:uid:partID:encoding:] will help you fetch each of those parts.
-[MCOIMAPMessage htmlRenderingWithFolder:delegate:] will return the rendered content as HTML (or nil if you don't provide all the content of the parts through the delegate.
-[NSString mco_flattenHTML] is also useful if you'd like to convert the HTML to a unformatted string.

Mail Message total size limit in mvc

I'm using System.Net.Mail and MailMessage to put together emails with attachments and send using SmtpClint but I have a email limit of 19mb.
I have a simple form with a number of textboxes or dropdowns and 3 possible attachments, I tested adding a single 18mb attachment but got a mail undeliverable response saying that the message was 24mb large.
So far no matter what I search I can only find information about mail attachments rather than the mail message as a whole so if push comes to shove I'll just add some code to check each attachment size, add em up then make sure they're all under 14/15mb total.
Any ideas/suggestions/links would be much appreciated.

Rails Action Mailer - Strip footer information

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.

Resources