Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old January 3rd, 2013, 10:44 PM   #1 (permalink)
Member
Thread Author (OP)
 
Join Date: Dec 2011
Location: chennai
Posts: 158
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default send mail from my android listview use javamailapi

Hi.,


I have to develop one android application. here i have to send mail automatically from my android application.so i have use javamailapi here.

I have to send mail listview vlaues from my android application.

These is my code:
[HIGH]
public class InvoiceOrder extends Activity {


String mGrandTotal;

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.invoice);
ListView mLstView1 = (ListView) findViewById(R.id.listView1);


CustomerAdapter mViewCartAdpt = new CustomerAdapter(
InvoiceOrder.this);
mLstView1.setAdapter(mViewCartAdpt);

Button login = (Button) findViewById(R.id.mBtnSubmit);
login.setOnClickListener(new View.OnClickListener() {

public void onClick(View arg0) {
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");

Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("mroslinmary@gmail.com","AS Dz78xc123");
}
});

try {

Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("krish.v@mercurygfyt.com"));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse("demo@mercurygfyt.com"));
message.setSubject("Testing Subject");
message.setContent("This is your product name : "+
"Hi Krishna", "How are you");
Transport.send(message);

System.out.println("Done");

} catch (MessagingException e) {
throw new RuntimeException(e);
}
}



[/HIGH]Here i have to run the app means am getting the Hi Krishna How are is send successfully to demo@mercuryminds.com

But i have to send listview .how can i set the listview to my message.setContent();field.please give me some ideas.

Advertisements
krishnaveni is offline  
Last edited by krishnaveni; January 17th, 2013 at 12:41 AM.
Reply With Quote
sponsored links
Reply
Tags
android, java, javamail, sendmail


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 08:16 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.