1

In my application I have use GmailSender activity. By using that i can send email very well with Activity.

Now I want to send email in Background i.e. at particular time using service. I tried to make object of that GmailSender class and used its sendMail method to send mail in Service. but however it does not execute.

Please give me solution for schedule the email sending using service.

EDIT:

I have tried that GmailSender in other program with Activity and it works well but in the program which i am currently working it don't work with service.

The exception i get is :

javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
04-20 11:53:36.693: VERBOSE/sendMail method(710):   nested exception is:
04-20 11:53:36.693: VERBOSE/sendMail method(710):     java.net.SocketException: Permission denied 

and for above error i have tried this link too but its not working with me.

--Thanks RB

Community
  • 1
  • 1
Ravi Bhatt
  • 1,930
  • 1
  • 14
  • 27
  • 3
    If the code "does not execute", try running the code. If the code gives you errors, consider editing your question with error information. – CommonsWare Apr 19 '11 at 20:23
  • @CommonsWare : Thanks for above comment. i have used log to trace exception. please check out Edited post for that. – Ravi Bhatt Apr 20 '11 at 06:50

1 Answers1

2

You are probably missing the INTERNET permission in your manifest.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491