title: Using AsyncTask to Send Android Email
body: <p>I had recently asked a question regarding the following code:</p>
  
  <p><a href="https://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a">Sending Email in Android using JavaMail API without using the default/built-in app</a></p>
  
  <p>I had asked this in regards to a network error, as per a previous question:</p>
  
  <p><a href="https://stackoverflow.com/questions/14373468/need-help-debugging-email-code">Need Help Debugging Email Code</a></p>
  
  <p>My question is, how would I implement an AsyncTask in order to successfully send an email with this Android code?  Every tutorial that I see informs me that I should do</p>
  
  <pre><code>extend AsyncTask {
  </code></pre>
  
  <p>However, GMailSender.java already has this defined as:</p>
  
  <pre><code>public class GMailSender extends javax.mail.Authenticator
  </code></pre>
  
  <p>Would anyone be able to help me?  Thanks!</p>
  
  <p>NOTE:</p>
  
  <p>Please don't be like the idiot who had -1<sup>ed</sup> this question and posted the exact answer as was given in <a href="https://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a">Sending Email in Android using JavaMail API without using the default/built-in app</a>.  I am unable to use that exact coding, due to the fact that it is no longer possible to run a network operation on the main thread of an Android application.  I am looking for a way to use AsyncTask in order to run the operation in the background.  What I am unable to find out is how to do</p>
  
  <pre><code>extend AsyncTask {
  </code></pre>
  
  <p>without touching</p>
  
  <pre><code>public class GMailSender extends javax.mail.Authenticator
  </code></pre>