Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:17:03+00:00 2026-05-24T23:17:03+00:00

has anyone know how to put/move this email send code to the service?? here’s

  • 0

has anyone know how to put/move this email send code to the service??
here’s the code :

Intent i = new Intent(Intent.ACTION_SEND);
            i.setType("text/plain");
            i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"myemail@hotmail.com"});
            i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
            i.putExtra(Intent.EXTRA_TEXT   , "body of email");

here’e my service code (Not Works and give me some “force close”):

@Override
    public void onStart(Intent intent, int startid) {
        //Toast.makeText(this, "My Service Started", Toast.LENGTH_LONG).show();
        sendEmail();
    }

    public void sendEmail()
    {
        Intent i = new Intent(Intent.ACTION_SEND);
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        i.setType("text/plain");
        i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"myemail@hotmail.com"});
        i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
        i.putExtra(Intent.EXTRA_TEXT   , "body of email");

        try {
            getApplication().startActivity(Intent.createChooser(i, "Send mail..."));
        } catch (android.content.ActivityNotFoundException ex) {
            Toast.makeText(EmailService.this,ex.getMessage(), Toast.LENGTH_SHORT).show();
            Toast.makeText(EmailService.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
        }

    }

please help for solving my problem.. thanks..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:17:04+00:00Added an answer on May 24, 2026 at 11:17 pm

    because i want to sent email silent’ly via background

    That is not possible via ACTION_SEND. You will need to integrate your own SMTP library (there’s an Android port of JavaMail available someplace) if you want to send email without user involvement.

    Not Works and give me some “force close”

    Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your “Force Close”.

    Also, do not use getApplication(), as you do not need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know if this has been released yet? I went to asp.net and
Does anyone know if this subversion bug has been dealt with? https://svn.apache.org/repos/asf/subversion/tags/1.6.9/www/faq.html#windows-access-denied I'm getting
Has anyone ever seen this and does anyone know how to fix it ...
Has anyone ever tested, or does anyone know, the performance differences of these two
Does anyone know if Visual Studio 2008 has a mechianism in web applications to
Does anyone know of an editor that has the ability to enforce exact line
Has anyone written, or know of a library, that generates fairly accurate looking Western
Does anyone know of a jQuery plugin that has 'helpers' or extensions like those
Does anyone know of a bug tracking piece of software that has community based
Does anyone know of a List implementation that has a constant time get(int index)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.