Put raw emails into an IMAP account? - email

I am working on testing internationalization of an email reader application. As such I'd like to have a bank of emails with unusual subject encodings and the like to test with. I have been successful at identifying some emails with the headers endoded in specific encodings I would like to test, however I'm not sure how to successfully get the emails into an IMAP account (or alternatively a POP3 account would suffice as well) without butchering the existing headers/encodings.
With Outlook, for example, I can drag and drop messages into the IMAP account from my regular POP3 email account, or use the "resend" feature to send the message to a different account, however, with both of those solutions, outlook re-encodes the headers using it's own choice of encodings. So, for example, instead of the subject being base64 encoded, suddenly it's quoted-printable encoded, and I need it to stay base64 encoded.
So can anyone suggest how to get raw emails imported into an IMAP (or Pop3) account without changing the header encodings for fields such as subject?

Just use some IMAP client, you can store messages to IMAP server.
One free C# IMAP client you can get from:
http://www.lumisoft.ee/lsWWW/download/downloads/Examples/
SotreMessage allows you store raw message to IMAP server.
Also if you have messages in IMAP server and wnat to ttransfer them, you can use IMAP sync application from same link.

If it's just for testing, set up an IMAP server locally, and store the messages on that. Choose some fairly transparent storage so that each message is a file on the server. Don't use an email client to write them, they are just text files (and in particular not Outlook!)

Related

how to send email from thunderbird such that only one copy is uploaded?

I use Thunderbird with an IMAP server to access incoming email as well as for online storage of mail, and SMTP server for outgoing email. Every time I send an email, it first sends it via SMTP and then uploads it separately to my IMAP server's Sent Items folder. This is not only inefficient, it's also risky as sometimes, on a poor-quality connection, I can send out an email by SMTP but then fail to save it on the server with IMAP, leaving me without any copy of the email I sent (and Thunderbird doesn't save it in the outbox in such cases).
Is there any way I can set up some local and/or server-side software such that (1) the mail only needs to be uploaded once and (2) it will reliably appear in my Sent Items immediately, without delay (and without requiring it to be re-downloaded) and then also hopefully (3) when my connection is poor and an email can't be saved to the IMAP folder, it automatically stays in my local outbox until properly sent and synched?
Local mail clients have been around for so long now, I am really surprised that there appears to be no solution for this! Seems like webmail is the only robust solution, but that's no good for poor quality connections either.
I am thinking of solutions like offlineIMAP and dovecot, but wondered if anyone has got/seen an outline for how such a setup could be organised?
This is not possible using imap, the protocol just don't manage at all the sending of messages.
You could manage to do that using sieve scripts while telling postfix to deliver the message to the sender but that won't be robust and would save the email two times in the Sent folder if the client is not configured for your liking.
Overall, this is a bad idea.
From https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol#Disadvantages:
"Unlike some proprietary protocols which combine sending and retrieval operations, sending a message and saving a copy in a server-side folder with a base-level IMAP client requires transmitting the message content twice, once to SMTP for delivery and a second time to IMAP to store in a sent mail folder. This is remedied by a set of extensions defined by the IETF LEMONADE Working Group for mobile devices: URLAUTH (RFC 4467) and CATENATE (RFC 4469) in IMAP and BURL (RFC 4468) in SMTP-SUBMISSION. POP servers don't support server-side folders so clients have no choice but to store sent items on the client. Many IMAP clients can be configured to store sent mail in a client-side folder, or to BCC oneself and then filter the incoming mail instead of saving a copy in a folder directly. In addition to the LEMONADE "trio", Courier Mail Server offers a non-standard method of sending using IMAP by copying an outgoing message to a dedicated outbox folder.[18]"
I like the idea of a clever IMAP server that handles handing off a message via SMTP through the use of an outgoing message folder, which the Courier Mail Server seems to be doing.
The set-up would need a 'smart' local SMTP server (defined below) as well as either a normal online IMAP server or else alternatively a local/offline IMAP server capable of keeping local offline copies of everything and synchronising when connected.
The 'smart' local SMTP server would need to handle the job of arranging for the message to be sent. In one configuration, it could simply do this as normal. But in another configuration, it could communicate with a 'smart' remote SMTP server, and, instead of sending the outgoing message to that server, it could tell that other server that the remote IMAP server has whatever particular message and, then the remote SMTP server could fish out the message from the remote IMAP server and send it on its way.
Such a configuration could be managed without a special email client. The only change from a standard configuration would be (1) setting IMAP to save sent messages in an 'outgoing' folder, and (2) setting the SMTP server to the 'smart' local SMTP server instead of the normal remote SMTP server.
None of this exists, but it could be implemented fairly easily by someone who was comfortable with both SMTP and IMAP protocols and server implementations, right?

How to read users outlook email using Oauth2?

I'm building a service which scans peoples email for specific PDF attachments and indexes them. I implemented this with OAuth2 for Gmail using their extensive Gmail API which works perfectly fine.
I now want to implement the same for outlook/live/hotmail. So I searched around, and I mainly read that you can "Connect to Outlook.com IMAP using OAuth 2.0" (tutorial here). The thing is that this implements a full IMAP connection. As far as I know this is more meant for aftermarket applications with which the user can view and send his email, not for applications which need to download some email in the background (like mine).
I haven't worked with IMAP from within code, but the main problems I see with this now is that:
If I read emails they will be set to "read" in the inbox of the user, which I obviously don't want (I don't want to interfere with the normal email usage of the user).
I will need to either stay connected with all email inboxes, or constantly loop through all email inboxes to get new emails.
My questions are actually;
Is there no other way than IMAP to get users outlook.com email?
Or are my problems actually not problems and should I just create an IMAP "receiver" for all the outlook email accounts?
In answer to point #1, according to Max, you can use body.peak to avoid this.
In answer to point #2, according to triplee, you can connect to all of the accounts and then use an IMAP extension called IDLE.
In answer to point #3, I found the Outlook REST API which includes options to read the email and you can call GET https://outlook.office.com/api/beta/me/messages on a regular basis to get all messages in the user's account or you can call GET https://outlook.office.com/api/v1.0/me/messages on a regular basis to get all messages in the user's inbox. You can find a full list of the REST APIs operations here.
In answer to point #4, I believe that some of your problems are problems and others aren't. I believe that you don't have any technical problems. However, I believe that you are correct that IMAP is not designed for applications like yours as is shown in the Wikipedia article on IMAP which reads (bold is mine),
In computing, the Internet Message Access Protocol (IMAP) is an Internet standard protocol used by e-mail clients to retrieve e-mail messages from a mail server over a TCP/IP connection. IMAP is defined by RFC 3501.
Also, in RFC 3501 which defines the original IMAP protocol it refers to email clients which from the absract reads (bold is mine),
The Internet Message Access Protocol, Version 4rev1 (IMAP4rev1) allows a client to access and manipulate electronic mail messages on a server.

Email that allows auto responses via subject line with attachments

i want to host a email client on my web server that allows messages to be processed via subject line, i looked into roundcube's autoreply but that was only a global message for all incoming emails, for example, if my customer emailed me with subject line HOSTING, it would be filtered and sent an auto response with an attached pdf file of our hosting plans
I would actually use Gmail's filters to do this, as otherwise it would be quite complicated. I would forward all the mail to Gmail, and use Gmail's filters (and canned response lab feature) to respond with the PDF attachment.

Export all my emails from Gmail account as xml

Bizarrely, I have been using an email account to store recipes.
I want to export all the messages to an XML format or similar, which I would be able to easily reproduce on a Wordpress blog or similar. Or simply print out all the recipes, but with some formatting put in place.
Gmail offers an RSS feed for labels, and exporting to external email client and I also found something called backup goo which allows me to export all the mails as files .eml in MIME format.
Anyone shed any light on working with this kind of stuff. Essentially, this may seem like a really frivously problem, but in fact it's a problem of me not being able to access this kind of personal data which I should be able to move elsewhere and represent to myself easily.
You can forward your emails to Thunderbird and use ImportExport tools addons to export all your emails as :
html.
csv.
xls.
mbox.
plain text.
Is Gmail the only option, you can use? The default setting for Gmail is to use IMAP protocol for exchanging e-mail. This means, all your e-mails (receipes) are still on GMail server. I would suggest using a different program (mail client) that offers more export options than Gmail.
I can connect to my Gmail account with Mozilla Thunderbird (using standard credentials, like IMAP server address, port, login, password) and browse all the messages from there. And, because this is IMAP, they're synced, not downloaded, so I have exact copy in both Gmail and Thunderbird. I don't remember Thunderbird (haven't been using it for ages! :), but I'm pretty sure that you'll find more export option in there or in any of their plugins, than you would find in Gmail.

Email client detection

I have a project to send some email to end clients. My client need to know what exactly "Email Client" they use to read the mail. I know a hidden can get the open event and even the user agent they use, so by parsing user agent i can get most email clients info.
But it's hard to detect some popular web mail clients like "Gmail", "Hotmail" and "Yahoo mail". Because user agent return is only the browser user agent string.
Edit: i think i need a result more like this:
here
You will not be able to perfectly detect the e-mail client your users are using.
In E-Mail headers some programs choose to include the X-Mailer tag, which tells you exactly with what program and version your user is sending the e-mail - of course that can be faked. Not all programs use the X-Mailer tag, I e.g. couldn't find it in a mail sent with Microsoft Outlook 2010.
Besides that you could do some guesswork by the Received from tag in the e-mail headers, but in the end you can use SMTP and POP3 with most webmailers like GMail or Yahoo. That means even though your e-mail is sent via servers from google.com, the originating client could still be Outlook or Thunderbird and not GMail itself.
Maybe we can help you if you better if you could tell us why exactly your client wants to know the programs the users use to read their mail? Probably to tune the appearance of newsletters?
I know this is a really old topic, but the most reliable way to detect webmail client for gmail, hotmail, outlook.com and office365 is to use a tracking pixel. What you will want to do is geo-locate the IP address and you'll find gmail all comes from mountain-view and microsoft based products from redmond.
I haven't validated this with non-US users, but I'd imagine the caching services they use will all be in the same place.
Cheers