2016-01-23 63 views
1

在這裏,我打算髮送關於特定電子郵件的數據。如何在Android中發送特定電子郵件的反饋?

數據包含發件人姓名,發件人電子郵件和發件人郵件。 將以上所有信息發送到我的郵箱。

請幫我解決。

+0

你的意思是你想例如點擊一個按鈕並打開帶有預填充字段(發件人,主題和內容)的GMail編輯器? – thetonrifles

+0

沒有傢伙我不想這樣。看我填寫所有的信息,然後點擊發送按鈕。我將通過電子郵件收到所有信息。 –

+0

我不想打開intent.chooser我直接發送電子郵件來點擊我的活動按鈕。 –

回答

0

我用這個包裝:

所有的
public static void sendEmail(Context ctx) { 
     Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
     String[] recipients = new String[]{"***[email protected]***"};// Replace your email id here 
     emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipients); 
     emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "*TITLE*");// Replace your title with "TITLE" 
     emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, ""); 
     emailIntent.setType("***text/plain***"); // set content type here 
     ctx.startActivity(Intent.createChooser(emailIntent, "Send E-mail..."));// it will provide you supported all app to send email. 
    } 
1

首先創建要獲得反饋的電子郵件。 所以你有你的電子郵件和密碼。

然後創建一個包含一個EditText設有編號的活動

<EditText android:id="body" 
    android:layout .... /> 
<EditText android:id="useremail" 
    ... /> 
<EditText android:id="username" 
    ... /> 

只要按照下面的鏈接: link

,並填寫以下信息:

  GMailSender sender = new GMailSender("[email protected]", "password"); 
      sender.sendMail("Users Feedback", 
        "User Name:\t"+((EditText)getValueById(R.id.username).getText())+"\n" 
        +"User Email:\t"+((EditText)getValueById(R.id.useremail).getText())+"\n\n" 
        +"Content:\t"+((EditText)getValueById(R.id.body).getText()), 
        "[email protected]", 
        "[email protected]"); 
相關問題