Swathi,

Did you ever figure this one out??

Thanks,
double

On May 12, 1:40 am, Swathi <swathimuddin...@gmail.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to