1

Here i am going to do send my data on particular E-mail.

Data contains name of the sender,email of the sender and message of the sender. All above information to my mail.

Please, help me to solve out.

Milan Gajera
  • 962
  • 2
  • 14
  • 41
  • You mean you want for example to click on a button and open GMail editor with pre-filled fields (sender, subject and content)? – andrea.petreri Jan 23 '16 at 09:01
  • No dude i don't want like this.Look i fill all the information and click on send button. All information i will get on my email. – Milan Gajera Jan 23 '16 at 09:03
  • i don't want to open a intent.chooser i directly send the email to click on my activity button. – Milan Gajera Jan 23 '16 at 09:04
  • Is this possible in android? i want like feedback type in many website. Please, help me – Milan Gajera Jan 23 '16 at 09:06
  • Of course it is possible, even if you need to use external libraries or rely on external services for doing this. An example is [here](http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a). – andrea.petreri Jan 23 '16 at 09:08
  • http://stackoverflow.com/questions/19700728/sending-email-from-gmail-directly-in-android-from-my-app-without-opening-the-gma – koutuk Jan 23 '16 at 09:10
  • ok according to your comment i need a sender mail and his/her password.I am talking about feedback type.In which there is no need to login at any account just send their feedback. – Milan Gajera Jan 23 '16 at 09:10
  • 1
    @MilanGajera If you look at code, there a GMail sender is used and GMail server requires authentication for sending emails. It depends on SMTP server you will use, because protocol doesn't require authentication to be mandatory. – andrea.petreri Jan 23 '16 at 09:16
  • Another option is that you use a REST service handling email send for you. An example could be [AWS SES](https://aws.amazon.com/ses/). There is a daily limit on free emails (I think around 1000 or more). – andrea.petreri Jan 23 '16 at 09:20

2 Answers2

1

First of all create the email where you want to get the feedback. So you have your email and your password.

Then create an activity that contains an EditText with an id

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

just follow the link below: link

and fill the following info:

            GMailSender sender = new GMailSender("username@gmail.com", "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()),   
                    "user@gmail.com",   
                    "user@yahoo.com"); 
Community
  • 1
  • 1
Chris Sim
  • 4,054
  • 4
  • 29
  • 36
0

I'm using this wrapper:

public static void sendEmail(Context ctx) {
        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        String[] recipients = new String[]{"***your.mail@example.com***"};// 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.
    }
Prags
  • 2,457
  • 2
  • 21
  • 38
Vyacheslav
  • 26,359
  • 19
  • 112
  • 194