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.
Related
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
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.
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'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.
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.