2016-07-10 23 views
0

私はアンドロイドアプリを開発しています。私はいくつかの編集テキストと送信ボタンを持っています。 送信ボタンをクリックすると、ユーザーが入力した編集テキストのすべてのフィールドを特定の電子メールIDに送信する必要があります。 どうすればいいですか教えてください。ボタンのonClickListner()メソッドを使用しているボタンのクリックでメールに詳細を送ってください

enter image description here

+0

[送信メールの意図](http://stackoverflow.com/questions/8701634/send-email-intent)の可能な複製 – TapanHP

答えて

0
String s = editText.getText().toString(); 

あなたはこれを行うことができ、複数のeditTextsで作業しているように、この

Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + email)); 
    emailIntent.setType("text/plain"); 
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); 
    emailIntent.putExtra(Intent.EXTRA_TEXT, s); 
    //emailIntent.putExtra(Intent.EXTRA_HTML_TEXT, body); //If you are using HTML in your body text 

    startActivity(Intent.createChooser(emailIntent, "Send Email via")); 

はすでに、

String s = (editText1.getText().toString() + "\n" + editText2.getText().toString() + "\n"+editText3.getText().toString() + "\n" + editText4.getText().toString() + "\n" + editText5.getText().toString() + "\n" + editText6.getText().toString() + "\n"); 
Here

に答え

と同じスニペットを使用してください。 https://github.com/enrichman/androidmail

mandrillappと名付け利用できるAPIがあります:あなたはthis answer

がここにも、このコードスニペットを見る前にユーザーとの対話なしに電子メールを送信する方法を知りたい場合は

これを読みます完全コード用のブログ:https://www.mindstick.com/Articles/1673/sending-mail-without-user-interaction-in-android

+0

こんにちは、答えをありがとうが、上記のコードは、Gmailのアプリを開いている。私は電子メールIDをボタンに割り当て、ユーザがそれを知っていない状態で詳細を電子メールに送信したい。電子メールは、アプリを開かずに送信する必要があります。助けてください。 –

関連する問題