Adding links to an email message - android

I was wondering if it is possible to hook into the gmail and email
applications and check to see if it contains text that matches a
regular expression, and if it does, make that text into a link with a
URI that would open my application. What i am thinking of is similar
to how the gmail application can detect a web address or phone number
and make it a link. Is something like this possible?

The Gmail app is closed source and you only have the hooks they give you. AFAIK regular-expression-to-hyperlink-conversion isn't one of them:
Extending Android's Default Gmail/Email Applications
Depending on what you're doing, you might be able to send mail through some kind of gateway which does this work on the message prior to delivery. So rather than emailing johndoe#gmail.com people could write to johndoe#example.com, and the work of translating phrases into URIs could be done at example.com then forwarded to gmail.com with links in place...
But people are link-savvy these days. You can make links plenty readable, for instance look at http://en.wikipedia.org/wiki/URL ...fairly obvious, no magic required and I can enter that even without Google's help.

Related

Storing additional data to mail in IMAP

Introduction
I have a xy-problem
x: High level goal
I have dream: I want to store additional data to mails which are in IMAP. I the long run I want to be able to access this data via thunderbird and k9 (android app (mail use agent)).
Use cases:
I want to store a note in html format for this mail.
Upload a PDF file for this mail.
I want to store a re-submission date on the mail. Like google inbox snooze feature: Move the mail to a "do later" folder until the date is reached. (Evaluating this date and moving the mail to inbox again is not part of this question)
But I have no clue how to store additional data
y: My current thoughts about solving it
I need a way to identify a message in IMAP. I think the message id (without folder name) should work. I know that message IDs can have duplicates, but I see no other way. Please leave a comment, if you have a better idea.
Now I need a way to store this mapping somewhere:
`user#imapserver:message-id` --> `additional-data`
Question
How to store this mapping, so that thunderbird and k9 could access it?
Of course I know that thunderbird and k9 can't access this data today. How to patch them is a different question.
Background
I like free software and I like free communication. Up to now I use WhatsApp, Threema and other tools. But in the long run I want a free (like in software) solution. Email is wide spread, and I think it makes more sense to improve email than to create something new.
You could store annotations in a parallel mailbox as MIME messages using APPEND. You'd have to figure out a way to map annotations from one message to another.
So you can find the related message easily, you'll want it easy to search for. You could do something like using the message-id of the source message as the subject of the annotation message, or a transformation of the message id as the message id of the destination message.
Here are my thoughts on it... here is the current proposed and accepted standard for IMAP4 which is the current version...
https://www.rfc-editor.org/rfc/rfc3501
Here is a wiki link to show the previous versions and the progress that has been made over time ...
https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol#IMAP4
I think the question is a good one, but maybe if your idea is good enough, contact the people that are in charge of the protocol and think about ways to potentially make IMAP5 with the kinds of functionality that you want to expand it to be able to utilize...
I would say that the best way would be to try making the IMAP protocol better. Read over all of the functionality that it currently supports and make suggestions to the group in charge of it. The additions that you are wanting to add sound great, but unless I misunderstood the question, I think that protocol updates might be the cleanest approach.
Sounds cool though.
Good luck... I hope you like my thoughts.
Have you considered Mailgun? It has an extensive API ( https://documentation.mailgun.com/api_reference.html#api-reference). Incoming messages can be stored, processed by your application and then sent via email. I believe you can add your own header field information (perhaps generating something like a GUID and using it for unique message tracking). Up to 10,000 emails/month are free (one of your preferences). If your application workflow and the API align, this might help get the job done.

Android specific MIME type list?

I have been asked to add a "share" method to one of my Android applications which allows users to share by 1) Facebook 2) SMS and 3) Email
While researching, I have found that to allow users to select from "messaging" applications, I need to create the following Intent:
Intent messageIntent = new Intent(Intent.ACTION_SEND);
messageIntent.putExtra(Intent.EXTRA_SUBJECT, title);
messageIntent.putExtra(Intent.EXTRA_TEXT, content);
messageIntent.setType("vnd.android-dir/mms-sms");
// title and content set elsewhere...
This kind of works, although I am also given email clients in my list...
My Questions:
Is there a list somewhere of the Android specific MIME types that are available for us to use? The "vnd.android-dir/mms-sms" seemed pulled out of thin air to me from the example I found.
Is there the proper way to get ONLY messaging clients (ie. not mail clients) - or is that pretty much impossible to do in Android.
Disclaimer: The above code snippet was found from another SO post. Perhaps it is just me failing at Google - but I cannot seem to find any documentation on the legit Android developer site which listed out that this was the correct way to do this, or what my options are.
I have been asked to add a "share" method to one of my Android applications which allows users to share by 1) Facebook 2) SMS and 3) Email
Please allow the users to share how the users want, which may or may not be via those means.
I have found that to allow users to select from "messaging" applications, I need to create the following Intent
No, that allows users to share via any application that happens to support that undocumented and unsupported MIME type. Not every "messaging" application will necessarily support that MIME type, and applications that are not "messaging" applications are welcome to support that MIME type.
Is there a list somewhere of the Android specific MIME types that are available for us to use?
Not really, as generally they are undocumented or under-documented (e.g., the constant shows up somewhere without explanation).
The "vnd.android-dir/mms-sms" seemed pulled out of thin air to me from the example I found.
It probably came from the Android source code.
Is there the proper way to get ONLY messaging clients (ie. not mail clients) - or is that pretty much impossible to do in Android.
There are ~7 billion people on the planet. Each of them is welcome to have a different idea of what a "messaging client" is, what a "mail client" is, etc. Those are descriptive marketing terms, not technical definitions.
ACTION_SEND is for sharing content via MIME type. Any application can offer to support ACTION_SEND for any given MIME type, as the developers of any application can write what they want. Whether any given application is a "messaging client", "mail client", or something else is up to the end user. You have no means of reading the minds of users, nor do you have any legal means to prevent other programmers from writing what they want.
Now, there are various script-kiddie hacks for limiting the share list to certain apps, by application ID (a.k.a., package name). However, while there is only one Facebook (though I seem to recall they have a few apps), there are many SMS and email apps, and it would be difficult, if not impossible, for you to come up with a list of all of them, let alone maintain that list over time.
My strong recommendation is to format your content usefully, and allow the users to share that content using the apps that they wish.

Is it possible to send feedback via android sdk without user's email (anonymous)?

I have always wanted to be able to have my users send feedback to my email address. Not a problem when using 'createChooser()' with ACTION_SEND type within an Intent. This may lead to a few very rare errors where there is not an application on the user's device to handle that Intent.
My question is: Is it possible to send an anonymous "from" to my developer email account so the User's email will not be required? I know basic HTML, and am wondering if this is possible with a 'form' in a 'WebView' (preferably less complicated) I Do not have a web server or access to one, and am only an individual developer, so that may throw that out of question.
Any insight is greatly appreciated, thank you for reading.
I don't think there is a reasonably easy way to do this with Intents. The best way I can see is have a couple of EditTexts for the message and maybe a title, and then a send Button at the bottom, then sending programmatically with a java class.
See this link for some info on how to do the actual sending part: http://www.developerfusion.com/code/1975/sending-email-using-smtp-and-java/
It's fairly straightforward.

Detect if a tweet is tweeted from a mobile phone

I am not sure about how can I tell that a tweet is tweeted from a mobile/smart phone.
I am using Tweepy for the twitter API. Twitter API can only tell us the source/client of a tweet (e.g. Twitter for Android).
That's why the only solution I see, is to compare the name of the client used to tweet to a list of mobile clients. (I should build the list by myself)
The list can be huge, that's why I am searching for another suggestion, hack or magic.
(Alternatively, do you know where can I find a good list of mobile app?)
As you've discovered, you can look at the source parameter.
This will give you two interesting things
The name of the client.
The URL of the client.
I'd suggest a two pronged approach. Look to see if the name says something like "for Android" or "mobile" - and check whether the URL points to iTunes, play.google, or similar.
According to Wikipedia
A new app is registered every 1.5 seconds, according to Twitter.
I would suggest looking at the Top 100 Twitter Applications (or similar) and then build your own list of the most commonly seen apps.

Android Custom URI Handler - Gmail App doesn't recognize?

I'm trying to open a link from my Gmail Application. If I send myapp://custom/params, Gmail only recognizes it as text. I can get the link to open my application "myapp" from a browser, though. How can I get around this?
I'd suggest that you use URIs with the content: scheme and a custom ContentProvider.
See http://developer.android.com/guide/topics/providers/content-providers.html.
I think this comes down to a problem with the way the GMail apps looks for stuff to link up as URLs in the body of a text formatted message. I believe you have two options:
Send the email message as HTML instead of plain text and explicitly href= link to your custom scheme.
Instead of hooking to a custom scheme, setup your app to handle protocol http with the host and path set to something unique. As long as you include the exact path the intent filter shouldn't get in the way of normal browsing to your website.
I haven't tried either of those. #2 I'm pretty definite will work, however #1 might be a bit cleaner depending on your app.

Categories

Resources