如何使用Mono for Android通过电子邮件发送文件

时间:2011-11-10 22:18:03

标签: sendmail xamarin.android

这会发送邮件,但不会显示附件。

{
        Intent mailIntent = new Intent(Intent.ActionSend);
        mailIntent.SetType("text/csv");

        mailIntent.PutExtra(Intent.ExtraEmail, new string[]{"rommyce@hotmail.com"});
        string path = root + nameFile;


        mailIntent.PutExtra(Intent.ExtraStream, Android.Net.Uri.Parse (@"file:/" + path));

        StartActivity(Intent.CreateChooser(mailIntent, "Send mail..."));
}

1 个答案:

答案 0 :(得分:-1)

        Intent mailIntent = new Intent(Intent.ActionSend);
        mailIntent.SetType("text/csv");

        mailIntent.PutExtra(Intent.ExtraEmail, new string[]{"xxxxxxr@hotmail.com"});
        //string path = root + nameFile;

        mailIntent.PutExtra(Intent.ExtraStream, Android.Net.Uri.Parse("file:///sdcard/ejemplo.csv"));

        StartActivity(Intent.CreateChooser(mailIntent, "Send mail..."));