Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link to individual mails in gmail

I want to download all emails in a gmail account and also want to get the unique url which will open the exact mail in gmail, off course with authentication. I tried using javax.mail imap library but Imap probably doesn't supports anything like it.

I can use "https://mail.google.com/mail/feed/atom" gmail feeds. but won't give me entire email and it only gives unread email and I don't want to miss any email

like image 768
Rohit Avatar asked Mar 22 '11 12:03

Rohit


People also ask

Can you link to a specific email in Gmail?

Click the Accounts and Import or Accounts tab. In the "Check mail from other accounts" section, click Add a mail account. Type the email address you want to link, then click Next. Select Link account with Gmail (Gmailify), then click Next.

Can you hyperlink to a specific email?

On the Insert tab, click Link or Hyperlink. Under Link to, click E-mail Address. Either type the email address that you want in the E-mail address box, or select an email address in the Recently used e-mail addresses list. If you want to change the link text, in the Text to display box, type the text.

Can you link email threads?

Create a link to a thread Open the email you want to share and click at the top toolbar. Select Create Link. Now the link is copied to clipboard. You can also access the link by clicking on the shared thread.


1 Answers

You can do this if you are using Google Apps for Business/Education. If you are, you can access the Gmail inbox feed (Atom) by using OAuth. OAuth can also be used to access Gmail via IMAP - you can then have complete access to the IMAP server programmatically, see Gmail IMAP and SMTP using OAuth.

Google has extended IMAP to allow developers to provide a more Gmail-like experience via IMAP, see: (Gmail IMAP Extensions, X-GM-EXT-1).

The unique message (X-GM-MSGID) and unique thread (X-GM-THRID) ids can be used to produce links to Gmail messages directly - you just have to hex encode the id long (e.g. Long.toHexString(x_gm_msgId)). Your link will then need need to be in the form of:

http://mail.google.com/mail?account_id=ACCOUNT_ID_HERE&message_id=MESSAGE_ID_HERE&view=conv&extsrc=atom

supplying ACCOUNT_ID_HERE (something like [email protected]) and MESSAGE_ID_HERE as appropriate.

I have been working in this area and think you might find my project useful, see: java-gmail-imap.

[NB: URLs formatted as above do not work on Gmail's mobile site (at least on iPhone/Safari).]

like image 79
Mark McLaren Avatar answered Oct 22 '22 09:10

Mark McLaren