0

I have an app which send mail to my defined mail address "myemail@own.com". For this i create my own Custom Email View Which contains check boxes message body and other options. Now i want that when send button is pressed my app should not go to gmail view or other email client view it directly submit the data

String recepientEmail = "myemail@own.comm";

// either set to destination email or leave empty

    Intent intent = new Intent(Intent.ACTION_SENDTO);

    intent.setData(Uri.parse("mailto:" + recepientEmail));

    startActivity(intent);

but on submit it opens gmail or chooser email client view but i dont want to show gmail view

User42590
  • 2,473
  • 12
  • 44
  • 85

1 Answers1

1

i add only explanation for modification required for any email server to this link : Click Here

1st change :

private String mailhost = "smtp.gmail.com

change to

private String mailhost = "your smtp email server address";

2nd change :

props.put("mail.smtp.port", "465");   
props.put("mail.smtp.socketFactory.port", "465"); 

change to

props.put("mail.smtp.port", your smtp port);   
props.put("mail.smtp.socketFactory.port", your smtp port); 

3rd change :

default properties are

props.setProperty("mail.transport.protocol", "smtp");   
props.setProperty("mail.host", mailhost); 

add more properties if your email server is required.

i hope this will help you.

Community
  • 1
  • 1
VISHAL VIRADIA
  • 1,388
  • 1
  • 15
  • 34
  • 1
    thanks for the great help.. Actually the linked example by you also have one problem that it uses hard coded email and pass. So when we use our smtp mail host so in this situation our sender should be according to the smtp maihost like if my smtp is "smtp.mysmtp.com" so in this my hard coded email should be myusername@mysmtp.com. Because when i send email using gmail smtp then i receive email from hard coded username. So when anyone send a mail then for he/she should have email address according to smtp mail host? – User42590 Apr 04 '13 at 14:28
  • gmail like public email server only allow you to send emails from user@gmail.com but not from user@yahoo.com. but if you have your personal email server like yourdomain.com, then you can specify user@anything.com in "To" email address. – VISHAL VIRADIA Apr 04 '13 at 14:53
  • and in "from" can be "sender@anything.com"? – User42590 Apr 04 '13 at 14:57
  • if your own email server, not public like gmail,yahoo then you can put "from" also "user@anything.com", this is bug in SMTP protocol. but use this with care, because this is not legal if you use this with wrong intention. if you want to use this for you only, the you can enjoy & free to use this bug. – VISHAL VIRADIA Apr 05 '13 at 04:05