title: Send email with attachment from Kivy app on Android, preferably by opening email client
body: <p>I have tried a few ways to send an email using Python in the Kivy app on Android. The closest I've come is using Plyer's email function (<a href="https://plyer.readthedocs.org/en/latest/#plyer.facades.Email" rel="noreferrer">https://plyer.readthedocs.org/en/latest/#plyer.facades.Email</a>), however it doesn't appear to support attachments.</p>
  
  <p>What I want my app to do is open the user's email client and populate the recipient, subject, body and attachment fields. The attachment will be a .csv file generate by my app.</p>
  
  <p>Does anyone have suggestions on how to do this? How can I modify this code to include attachments?</p>
  
  <pre><code>from jnius import autoclass, cast
  from plyer.facades import Email
  from plyer.platforms.android import activity
  
  Intent = autoclass('android.content.Intent')
  AndroidString = autoclass('java.lang.String')
  
  
  class AndroidEmail(Email):
      def _send(self, **kwargs):
      intent = Intent(Intent.ACTION_SEND)
      intent.setType('text/plain')
  
      recipient = kwargs.get('recipient')
      subject = kwargs.get('subject')
      text = kwargs.get('text')
      create_chooser = kwargs.get('create_chooser')
  
      if recipient:
          intent.putExtra(Intent.EXTRA_EMAIL, [recipient])
      if subject:
          android_subject = cast('java.lang.CharSequence',
                                 AndroidString(subject))
          intent.putExtra(Intent.EXTRA_SUBJECT, android_subject)
      if text:
          android_text = cast('java.lang.CharSequence',
                              AndroidString(text))
          intent.putExtra(Intent.EXTRA_TEXT, android_text)
  
      if create_chooser:
          chooser_title = cast('java.lang.CharSequence',
                               AndroidString('Send message with:'))
          activity.startActivity(Intent.createChooser(intent,
                                                      chooser_title))
      else:
          activity.startActivity(intent)
  
  
  def instance():
      return AndroidEmail()
  </code></pre>