You can find the correct MIME type to send a text message here:
http://www.openintents.org/en/node/121
(scroll down for the sample code)

Peli
www.openintents.org

On Jun 24, 7:02 am, doubleminus <[email protected]> wrote:
> Swathi,
>
> Did you ever figure this one out??
>
> Thanks,
> double
>
> On May 12, 1:40 am, Swathi <[email protected]> wrote:
>
> > I have tried to sendemailfrom myapplication in emulator , with
> > following code.
>
> > Intent sendIntent = new Intent(Intent.ACTION_SEND);
> > sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto);
> > sendIntent.putExtra(Intent.EXTRA_SUBJECT,
> > subject.getText().toString());
> > sendIntent.putExtra(Intent.EXTRA_TEXT,
> > body.getText().toString());
> > sendIntent.setType("text/plain");
>
> > startActivity(Intent.createChooser(sendIntent, "MySendMail"));
>
> > But i got an error "No applications can perform this action".
>
> > I tried by configuring Gmail in emulator, with the following code
>
> >         boolean debug = false;
> >         //Set the host smtp address
> >         Properties props = new Properties();
> >         props.setProperty("mail.transport.protocol", "smtp");
> >         props.setProperty("mail.host", "smtp.gmail.com");
> >         props.put("mail.smtp.auth", "true");
> >         props.put("mail.smtp.port", "465");
> >         props.put("mail.smtp.socketFactory.port", "465");
> >         props.put("mail.smtp.socketFactory.class",
> >                              "javax.net.ssl.SSLSocketFactory");
> >         props.put("mail.smtp.socketFactory.fallback", "false");
> >         props.setProperty("mail.smtp.quitwait", "false");
> >         Session session = Session.getDefaultInstance(props, this);
> >         session.setDebug(debug);
> >        try
> >        {
> >         // create a message
> >         Message msg = new MimeMessage(session);
> >         // set the from and to address
> >         InternetAddress addressFrom = new InternetAddress(from);
> >         msg.setFrom(addressFrom);
> >         InternetAddress[] addressTo =
> >                         new InternetAddress[recipients.length];
> >         for (int i = 0; i < recipients.length; i++) {
> >             addressTo[i] = new InternetAddress(recipients[i]);
> >         }
> >         msg.setRecipients(Message.RecipientType.TO, addressTo);
> >         // Setting the Subject and Content Type
> >         msg.setSubject(subject);
> >         msg.setContent(message, "text/html");
> >         Transport.send(msg);
> >        }
> >        catch (Exception e) {
> >                 // TODO: handle exception
> >            System.out.println("Exception in Message"+e.getMessage());
> >         }
> >     }
>
> > But i got an error but i got an error
> > "java.lang.verifyError:javax.mail.internet.Mimemessage."
>
> > Can anybody help me?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to