CSV file attachment gets not sending with email in Android -
i creating app generated .csv file.now sent file using email, mail received not getting file attachment.my code follows.
please me getting wrong.
i have tried link stackoverflow similar
button export;
file csvdirectory= new file(environment.getexternalstoragedirectory(),"csvfiles"); if(!csvdirectory.exists()) {`enter code here` csvdirectory.mkdirs(); } final file csv= new file(csvdirectory, "firstcsv.csv"); try{ if(!csv.exists()) { csv.createnewfile(); } path=csv.getpath(); export.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { sendmail(); } }); public void sendmail() { file f= new file(path); u1=uri.fromfile(f); intent sendintent = new intent(intent.action_send); sendintent.putextra(intent.extra_subject, "person details"); sendintent.putextra(intent.extra_stream, u1); sendintent.settype("text/html"); startactivity(sendintent); }
try in sendmail() instead of text/html
sendintent.settype("text/csv ");
Comments
Post a Comment