2016-01-23 40 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]"); 
相关问题