Mail Message total size limit in mvc - asp.net-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.

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 to send nested attachments?

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.

Download email attachment files using Indy IMAP4 in C++ Builder

I am looking for a step by step solution on how to download mail attachments using Indy Imap in C++ Builder (I use C++ Builder XE8). I have read some tutorial in Delphi, but really getting Confused.
For example, what should I do after selecting the mailbox?
ImapClient->UIDRetrieve()
or
ImapClient->RetrieveStructure()
or
ImapClient->RetrievePart()
or
ImapClient->RetrieveEnvelop().
Then, what should I do next to identify the MessagePart no, haveing the attachment file?
The Last One, how to save that file to local drive?
Should I translate the following in C++?
TIdAttachmentFile(mbMsgP.MessageParts.Items[liCount]).SaveToFile(fName);
But I cant create a statement like this
TIdAttachmentFile(IdMessage1->MessageParts->items[no])->SaveToFile("filename");
I have read some tutorial in Delphi, but really getting Confused.
Not surprising, since IMAP is a complex and confusing protocol in general. That is why TIdIMAP4 has so many more methods compared to other mailbox protocols like TIdPOP3 and TIdSMTP (and it doesn't even implement everything IMAP is capable of).
For example, what should I do after selecting the mailbox?
ImapClient->UIDRetrieve() or ImapClient->RetrieveStructure() or ImapClient->RetrievePart() od ImapClient->RetrieveEnvelop().
That really depends on what you intend to do with the emails and their attachments.
(UID)Retrieve() downloads an entire email, parsing it into a TIdMessage and marking it as "read" on the server.
(UID)RetrieveStructure() retrieves the parent/child hierarchy of the various MiME parts within an email, creating an entry for each part in a TIdMessage.MessageParts or TIdImapMessageParts collection, providing some basic descriptive information about each part such as content type and part number. The actual content of each part is not retrieved.
(UID)RetrievePart() retrieves the actual content of a specific MIME part of an email. You do not need to download the entire email. But you do have to download the email's structure first so that you know the part number that you want to retrieve.
(UID)RetrieveEnvelope() retrieves some basic top-level headers for an email: date, subject, from, sender, reply-to, to, cc, bcc, in-reply-to, and message-id.
Then, what should I do next to identify the MessagePart no, haveing the attachment file?
If you download an entire email, you would have to loop through its MessageParts collection looking for a TIdAttachment object containing the desired filename/contenttype that you are interested in.
If you download just a part of an email, you would have to retrieve the email's structure and loop through the resulting collection looking for an entry containing the desired filename/contenttype that you are interested in, then you can request that specific part's content.
The Last One, how to save that file to local drive?
If you download an entire email, then you would call SaveToFile() on the desired TIdAttachment object:
static_cast<TIdAttachment*>(IdMessage1->MessageParts->Items[no])->SaveToFile("filename");
If you download an email's structure, you can use (UID)RetrievePart() to retrieve the attachment's data into a TStream object, such as a TFileStream.

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.

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