How can I send an email directly from my app?

0

Hello People I wanted to know how I can send an email to an electronic account from my app without going through the middle of gmail ...! , I have seen several tutorials that send mails but all pass by the middle of gmail .. I would like to do it from my application according to the activity that arme ... IS THERE ANOTHER WAY TO DO IT ?? THANK YOU Try this way but I did not get any message to the recipient

  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    etContent = (EditText) findViewById(R.id.etContent);
    etRecipient = (EditText)findViewById(R.id.etRecipient);
    btnSend = (Button) findViewById(R.id.btnSend);
    btnSend.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            sendMessage();
        }
    });
}

private void sendMessage() {
    final ProgressDialog dialog = new ProgressDialog(ActivityMain.this);
    dialog.setTitle("Sending Email");
    dialog.setMessage("Please wait");
    dialog.show();
    Thread sender = new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                GMailSender sender = new GMailSender("[email protected]", "password");
                sender.sendMail("EmailSender App",
                        etContent.getText().toString(),
                        "[email protected]",
                        etRecipient.getText().toString());
                dialog.dismiss();
            } catch (Exception e) {
                Log.e("mylog", "Error: " + e.getMessage());
            }
        }
    });
    sender.start();
}
    
asked by user62207 25.09.2018 в 21:20
source

0 answers