In the project, the last one to contact us, the request is to click the number and email address can send mail, this time to solve the solution there are two, one is to call the system to send mail software, you can add a mailbox account can send mail, the second is to use JavaMail to send mail. In the online various Baidu, also has the test, the discovery all can not send the mail, also modifies such as QQ or 163 mailbox of what management password, opened the POP3,, SMAP service, can not receive the mail, later colleague reminds me, the system comes with is the Google provides the Mail software, estimates in the domestic cannot use, I try to download QQ mailbox, try a bit really useful, the following posted by the predecessor to the call system to send the mailbox software, code as follows
Mail.setonclicklistener (NewOnclicklistener () {@Override Public voidOnClick (View v) {Intent I=NewIntent (intent.action_send); //I.settype ("Text/plain");//Simulator Please use this lineI.settype ("message/rfc822");//Use this line on a real machineI.putextra (Intent.extra_email,NewString[] {"[email protected]" }); I.putextra (Intent.extra_subject,"your suggestions"); I.putextra (Intent.extra_text,"we very much hope to get your suggestion!!! "); StartActivity (Intent.createchooser (i,"Select Email application.")); } });
Android calls system mail, sends mail to specified mailbox