在Android应用程序中反馈邮件

时间:2014-02-03 05:49:14

标签: android email feedback

当用户填写反馈表单然后单击“提交”按钮时,用户信息将被发送到我的电子邮件地址,而不会要求用户登录他/她的帐户,即用户可以在没有我们的电子邮件凭据的情况下发送反馈。有可能吗?

如果是,请提供一些提示。

btnfeedbacksubmit.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        Intent Email = new Intent(Intent.ACTION_SEND);
        Email.setType("text/email");
        Email.putExtra(Intent.EXTRA_EMAIL, new String[] { "email here" });
        Email.putExtra(Intent.EXTRA_SUBJECT, "Feedback");
        Email.putExtra(Intent.EXTRA_TEXT, "Hi");
        startActivity(Intent.createChooser(Email, "Sending Feedback:"));

    }
});

2 个答案:

答案 0 :(得分:2)

尝试以下代码

 import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;

import javax.mail.*;

import javax.mail.internet.*;

import com.sun.mail.smtp.*;

public class Distribution {

public static void main(String args[]) throws Exception {
    Properties props = System.getProperties();
    props.put("mail.smtps.host","smtp.gmail.com");
    props.put("mail.smtps.auth","true");
    Session session = Session.getInstance(props, null);
    Message msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress("mail@tovare.com"));;
    msg.setRecipients(Message.RecipientType.TO,
    InternetAddress.parse("tov.are.jacobsen@iss.no", false));
    msg.setSubject("Heisann "+System.currentTimeMillis());
    msg.setText("Med vennlig hilsennTov Are Jacobsen");
    msg.setHeader("X-Mailer", "Tov Are's program");
    msg.setSentDate(new Date());
    SMTPTransport t =
        (SMTPTransport)session.getTransport("smtps");
    t.connect("smtp.gmail.com", "admin@tovare.com", "<insert password here>");
    t.sendMessage(msg, msg.getAllRecipients());
    System.out.println("Response: " + t.getLastServerResponse());
    t.close();
}
}

答案 1 :(得分:1)

您可以在应用中使用BackgroundMailLibrary在后台发送邮件!

但是他们中的许多人建议通过Google Play提供反馈(点击率按钮应该在Googlplay中打开您的应用)尝试使用此功能:

appirater

AppRater

RateMeMaybe