* mail (2.7.1)
Summary: Mail provides a nice Ruby DSL for making, sending and reading emails.
Homepage: https://github.com/mikel/mail
Path: /home/cb/.gem/ruby/2.6.6/gems/mail-2.7.1
The mail client in use, Thunderbird, has rules on some clients which move mail from the inbox to other specified folders.
Need help to read emails held in folders OTHER THAN inbox, for example, sent, cC etc.
The documentation seems to be silent on this issue.
Found the answer in mail/network/retriever_methods/imap.rb where the mailbox to search is set as an option as follows:
options[:mailbox]= where options is passed as the only parameter of Mail.find.
By default, it is set to INBOX.
To search the mailbox Sent folder use: options[:mailbox] = 'INBOX.Sent'.
Also, when constructing the search key, use the verb conjunction to as opposed to from in the case of the Sent folder.
Related
In this thread, I got help with a script to catch all of my emails in their respective folders together with the attachments via the modules net/imap and the gem email.
I had to change my provider. So now I have the problem of choosing a new email provider and re-upload my emails to that account.
Can you kindly give me advice how to do this with these (or further) modules? Meanwhile, I look through the documentations again myself. I don't want to be spoon fed, it's just that I am not knowledgable with the IMAP RFCs right now, but need the access right now.
If I read a file mail = Mail.read('path/to/file.eml'), how would I upload every attribute from the .eml file and how would I upload the attachments saved in the same file?
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.
Per this announcement - https://gsuiteupdates.googleblog.com/2019/03/threading-changes-in-gmail-conversation-view.html -- an email with the exact same from/to and subject will no longer thread in Gmail if the emails are system generated unless we somehow reference the original message information in the subsequent system generated emails.
Does anyone have ideas for how we would do this in CDO mail using ASP / VBScript? Am guessing we would have to call a Google API to get the message ID after it created the message as well.
Google was not able to provide any help over and above the language used in this blog article which was as below:
Additional details
If you are managing a system that sends email notifications to users
and want your emails to be threaded in Gmail conversation view, then
you have to ensure that your notifications:
1) Have the same subject
2) Have reference headers that reference IDs seen earlier in the
thread, or have references headers that consistently refer to the same
message ID
Ideas are appreciated.
I'm not sure why you're looking for any sort of Google API, this sounds to be the standard "References" and "In-Reply-To" headers that any email reply should have. Refer to section 3.6.4 "Identification Fields" in RFC 5322. To create this you'd need to read the Message-ID header of the email being replied to and use it in the References header.
Just read the Message-ID of the email you're replying to like any other header:
Dim OriginalMessageId as String
OriginalMessageId = originalEmail.Fields.Item("urn:schemas:mailheader:message-id")
And use it to create the References headers in your new email:
replyEmail.Fields.Item("urn:schemas:mailheader:references") = OriginalMessageId
replyEmail.Fields.Item("urn:schemas:mailheader:in-reply-to") = OriginalMessageId
If you need more of a pointer of how this would work, you might need to include more of the code of how you're reading a message and how you're replying to it.
I have created a distribution list in exchange that allow certain people from my company to receive emails from a particular email address. An example would be if you send an email to "blank#esi.com" then the people added to the distribution list would also receive it. Now I want to add some modification to this distribution list. If any Subject field of any incoming emails contains the phrase "RT" (without the quotes), send a copy of that email to "blank#tid.com". How can we achieve this?
I am currently using window server 2012 & Exchange 2013
You can use transport rules for this. In the GUI you go to Mail Flow, then Rules. When you add a rule you can select when it applies and what should happen when it does. In your case I would use "if subject or body includes (RT)" then "bcc message to.. (blank#tid.com)"
I'm working with actionmailer. I'm trying to send a mail from email_idA to email_idB, then fetch that email from email_idB, and do some string operations on it to look for specific keywords.
I understood how to send the email. But how do I receive that email from email_idB's inbox? What configurations do I need to do? And how do I extract the email body as plain text?
Did you mean fetch or receive ? Your question uses both these terms and not sure what you mean.
If you just want to do a keyword search on the mails you sent, why not store the outgoing mail in DB and do the search ? (as you said "somehow fetch that email")
To be able to receive emails in your rails app, you would need to implement the receive method in your mailer. Follow this link - link
If you meant fetching emails from your inbox then you have to use POP3. Follow this SO answer - link
Im not sure whats your requirement but I'm sure you will find the above links useful :)