Hi All,
I have been following this thread with some interest. Since I also want to
be able to send an email without any user intervention. Now before anyone
says that should not be possible since it would be a security problem, let
me point out that I can send an SMS message without user intervention, if I
have the permissions set properly. So I would expect that I would also need
to set permission to allow sending email as well.
The use case is: I want to have the ability to forward an SMS message to my
email account, and it may be possible that I have left my phone at home
where I can't access it to say "ok, go ahead Android send that email" I want
it to just forward the SMS without my having to be there.
I have been poking around a bit in the source code and found this in the
stock Android email app:
package com.android.email.mail.transport;
/**
* This class handles all of the protocol-level aspects of sending messages
via SMTP.
*/
public class SmtpSender extends Sender {
public static final int CONNECTION_SECURITY_NONE = 0;
public static final int CONNECTION_SECURITY_TLS_OPTIONAL = 1;
public static final int CONNECTION_SECURITY_TLS_REQUIRED = 2;
public static final int CONNECTION_SECURITY_SSL_REQUIRED = 3;
public static final int CONNECTION_SECURITY_SSL_OPTIONAL = 4;
private Transport mTransport; 53 String mUsername; 54 String
mPassword;
..........
/** Allowed formats for the Uri:
* smtp://user:passw...@server:port CONNECTION_SECURITY_NONE
* smtp+tls://user:passw...@server:port CONNECTION_SECURITY_TLS_OPTIONAL
* smtp+tls+://user:passw...@server:port CONNECTION_SECURITY_TLS_REQUIRED
* smtp+ssl+://user:passw...@server:port CONNECTION_SECURITY_SSL_REQUIRED
* smtp+ssl://user:passw...@server:port CONNECTION_SECURITY_SSL_OPTIONAL
*
* @param uriString the Uri containing information to configure this sender
*/
public SmtpSender(String uriString) throws MessagingException {
...........
Which seems to have public methods to send email. As I understood the
philosophy behind building Android apps, which is to reuse
public Intents and methods to allow the scarce available memory to be
leveraged as much as possible.
So the question is: Can we use the existing code to send email in the stock
Android email app? Or is that sort of thing frowned upon?
Best,
Eileen Novack
--------------------------------------------------
From: "mikas" <[email protected]>
Sent: Wednesday, April 08, 2009 3:41 AM
To: "Android Developers" <[email protected]>
Subject: [android-developers] Re: Send Email Automatically
>
> The thing is, this code with "external libraries" worked fine for me
> with
> android-sdk_m5-rc15 and ADT-0.4.0 plugin for eclipse, but you have to
> install
> adt plugin manually, and then again you have to use proper javax.mail
> and
> activation libraries, I used those from maven java repository,
> eventually I
> had that code running, but it's useless within new android sdk, not to
> mention
> having your code run on a real device....
>
>
>
> On Apr 7, 8:05 pm, Noam <[email protected]> wrote:
>> Mikas,
>> I just noticed your post after I posted my last one.
>> If that is true, then how did you get it to work?
>>
>> Thanks,
>> Noam.
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---