Article Source: Original
1. Plain Text send:
Using this method will call other mail sender, the equivalent of clicking on the system of the Mail app or other mail client (QQ, Gmail, NetEase, etc.)
Public void SendEmail (string title, string content) { new Intent (Intent. Action_sendto); Email.setdata (Uri.parse ("Mailto:[email protected]"); Email.putextra (Intent.extra_subject, title); Email.putextra (intent.extra_text, content); StartActivity (intent.createchooser email, "Please select the Mail sender!") "));}
2. Send with Attachment:
Public voidsendemailwithattachment (string title, string content, File attachment) {Intent email=NewIntent (intent.action_send); String[] Emailaddrs=Newstring[]{"[Email protected]", "[email protected]"}; Email.settype ("Application/octet-stream");//---Set message type: With attachmentsEmail.putextra (Intent.extra_email, Emailaddrs); Email.putextra (Intent.extra_subject, title); Email.putextra (intent.extra_text, content); Email.putextra (Intent.extra_stream, Uri.fromfile (attachment)); StartActivity (intent.createchooser (email,"Please select Mail sender!")); }
Mobile app Service (mail)