I use this code to receive Gmail using a content provider. My problem is that the "fromAddress" field contains the name of the sender instead of the sender. For example, it will contain "John Doe", but I would like to have " john.doe@somewhere.net ".
The name in the field is the value set by the user in his mail client, it is not associated with my Android contacts.
Here is the code I'm using:
ContentResolver resolver = context.getContentResolver(); cursor = resolver.query(Uri.parse("content://gmail-ls/conversations/ myemail@gmail.com /", null, null, null, null); cursor.moveToFirst(); String fromAddress = cursor.getString(cursor.getColumnIndexOrThrow("fromAddress"))); cursor.close();
I know that the letter is not in any fields coming from this URI. I tried with this URI: "content: // gmail-ls / messages / myemail@gmail.com / 39920384203052", but it always returns a cursor with 0 entries for a valid messageId.
Please help me get the sender email for this Gmail email ...
Thanks!
Yan
source share