title: How to create Forgot password in android?
body: <p>I want an app in which i use Forgot Password. 
  I have a TextView, named forgot password. When i click on it, It shows a PopUp having edittext in which i can write Email Adrress and when i click on OK button it sent new passward on my mail id. 
  I use JSSEProvider class for protocols.</p>
  
  <pre><code>public final class JSSEProvider extends Provider {
  
  public JSSEProvider() {
      super("HarmonyJSSE", 1.0, "Harmony JSSE Provider");
      AccessController.doPrivileged(new java.security.PrivilegedAction&lt;Void&gt;() {
          public Void run() {
              put("SSLContext.TLS",
                      "org.apache.harmony.xnet.provider.jsse.SSLContextImpl");
              put("Alg.Alias.SSLContext.TLSv1", "TLS");
              put("KeyManagerFactory.X509",
                      "org.apache.harmony.xnet.provider.jsse.KeyManagerFactoryImpl");
              put("TrustManagerFactory.X509",
                      "org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl");
              return null;
          }
      });
  }
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>public class GMailSender extends javax.mail.Authenticator {   
  private String mailhost = "smtp.gmail.com";   
  private String user;   
  private String password;   
  private Session session;  
  
  String subject = null;
  String recipients = null;
  String sender = null;
  String body = null;
  
  static {   
      Security.addProvider(new JSSEProvider());   
  }  
  
  public GMailSender(String user, String password) {   
      this.user = user;   
      this.password = password;   
  
      Properties props = new Properties();   
      props.setProperty("mail.transport.protocol", "smtp");   
      props.setProperty("mail.smtp.host", mailhost);   
      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.getDefaultInstance(props, this); 
  }   
  
  protected PasswordAuthentication getPasswordAuthentication() {   
      return new PasswordAuthentication(user, password);   
  }   
  
  public synchronized void sendMail(String subject, String body, String sender, String recipients) throws Exception {   
      try{
      Log.e(""," recipients "+recipients);
  
      this.subject = subject;
      this.recipients = recipients;
      this.sender =sender;
      this.body = body;
  
      // Send this email in Async task, otherwise NetworkOnMainThread Exception will be thrown
      new MobiSnifferAsync().execute();
  
      }catch(Exception e){
         e.printStackTrace();
      }
  }   
  
  class MobiSnifferAsync extends AsyncTask&lt;Void, Void, Void&gt;{
  
      @Override
      protected Void doInBackground(Void... params) {
          try{
              Log.e("AsyncTask"," subject "+subject); 
              Log.e("AsyncTask"," body "+body);
              Log.e("AsyncTask"," sender "+sender);
              Log.e("AsyncTask"," password "+password);
              Log.e("AsyncTask"," recipients "+recipients); 
  
              Properties m_properties     = new Properties();
              m_properties.put("mail.smtp.host", "smtp.gmail.com");
              m_properties.put("mail.smtp.socketFactory.port", "465");
              m_properties.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
              m_properties.put("mail.smtp.auth", "true");
              m_properties.put("mail.smtp.port", "465");
  
  
              Session m_Session  =  Session.getInstance(m_properties, new Authenticator() {
  
                  protected PasswordAuthentication getPasswordAuthentication() {
                      return new PasswordAuthentication(sender, password); // username and the password
                  }
              });
  
  
              InternetAddress m_fromAddress    =   new InternetAddress( sender);
              InternetAddress m_toAddress      =   new InternetAddress( recipients);
  
              MimeMessage m_simpleMessage  =   new MimeMessage(m_Session);
              m_simpleMessage.setFrom(m_fromAddress);
              m_simpleMessage.setRecipient(RecipientType.TO, m_toAddress);
              m_simpleMessage.setSubject( subject);
              m_simpleMessage.setContent( body, "text/plain");
  
              Transport.send(m_simpleMessage);
              }catch(Exception e){
                 e.printStackTrace();
              }
          return null;
      }
  }
  
  
  public class ByteArrayDataSource implements DataSource {   
      private byte[] data;   
      private String type;   
  
      public ByteArrayDataSource(byte[] data, String type) {   
          super();   
          this.data = data;   
          this.type = type;   
      }   
  
      public ByteArrayDataSource(byte[] data) {   
          super();   
          this.data = data;   
      }   
  
      public void setType(String type) {   
          this.type = type;   
      }   
  
      public String getContentType() {   
          if (type == null)   
              return "application/octet-stream";   
          else  
              return type;   
      }   
  
      public InputStream getInputStream() throws IOException {   
          return new ByteArrayInputStream(data);   
      }   
  
      public String getName() {   
          return "ByteArrayDataSource";   
      }   
  
      public OutputStream getOutputStream() throws IOException {   
          throw new IOException("Not Supported");   
      }   
  }   
  }  
  </code></pre>
  
  <p>But don't know how to sent password on email id.
  Can anybody tell me, how can i do this.</p>