0

Possible Duplicate:
Sending Email in Android using JavaMail API without using the default/built-in app

I want to send an email with an attached audio file over gmail that i record with my application. Can I send a direct mail from android with attachment without getting the options to choose the method of sending? (bluetooth,etc etc ) ? I just want to send the mail with the attachment on the click of a button.

Can I do this with android? Also, i would be obliged is I could get the code for sending mail over gmail with android.

Community
  • 1
  • 1
Aakash Anuj
  • 55
  • 1
  • 1
  • 6
  • See stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a – dira Jul 05 '12 at 07:59
  • if you menage to send mails with audio attached could you please answer this? http://stackoverflow.com/questions/11307840/android-share-intent-audiotrack – Lorenzo Sciuto Jul 05 '12 at 08:46

3 Answers3

1

here is a complete example which sends a background email (using gmail account) to others, ofcourse with attachment. Send email with attachment using GMAIL account.

Find an example project here in this project you need to set the following gmail account details in MailSenderActivity class

private static final String GMAIL_EMAIL_ID = "";
private static final String GMAIL_ACCOUNT_PASSWORD = "";
private static final String TO_ADDRESSES = ""; // to email addresses separated by comma

If you don't need the ZipUtility class, remove that and use it according to your need

sunil
  • 6,444
  • 1
  • 32
  • 44
0

unfortunately, there is no way to force the user to choose the Gmail app instead of the built in mail client.

most users already have a gmail account if they own an android client so they'll probably use it anyway.

thepoosh
  • 12,497
  • 15
  • 73
  • 132
0

As others have already posted you can use the java mail api, BUT you'd have to hardcode your email and password which isn't something advisable.

What you can do is connect to a webservice that can send emails and use it instead. That way you reduce your security risks.

Benito Bertoli
  • 25,285
  • 12
  • 54
  • 61