To send email via gmail account to u need to follow thw steps below :
1. Add GmailSender.java file [Download]
2. Add JSSEProvider .java file [Download]
3. Add three jar files (mail.jar,activation.jar,aditional.jar) [Download]
4. Add Internet permission in manifest.xml file
5. Herecomes the final step :
OnClick of send button u want to send email. Here is the code.
final Button send = (Button) this.findViewById(R.id.send);
send.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
try {
GMailSender sender = new GMailSender("username@gmail.com", "password");
sender.sendMail("This is Subject",
"This is Body",
"user@gmail.com",
"user@yahoo.com");
} catch (Exception e) {
Log.e("SendMail", e.getMessage(), e);
}
}
});