зеркало из https://github.com/mono/mail-archives.git
123 строки
3.6 KiB
HTML
123 строки
3.6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [mono-android] Saving a log file and attaching to an e-mail
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Saving%20a%20log%20file%20and%20attaching%20to%20an%20e-mail&In-Reply-To=009401ccb8f1%24ef2af220%24cd80d660%24%40nc-software.com">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="007741.html">
|
|
<LINK REL="Next" HREF="007744.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[mono-android] Saving a log file and attaching to an e-mail</H1>
|
|
<B>Jonathan Pryor</B>
|
|
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Saving%20a%20log%20file%20and%20attaching%20to%20an%20e-mail&In-Reply-To=009401ccb8f1%24ef2af220%24cd80d660%24%40nc-software.com"
|
|
TITLE="[mono-android] Saving a log file and attaching to an e-mail">jonp at xamarin.com
|
|
</A><BR>
|
|
<I>Mon Dec 12 16:05:55 EST 2011</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="007741.html">[mono-android] Saving a log file and attaching to an e-mail
|
|
</A></li>
|
|
<LI>Next message: <A HREF="007744.html">[mono-android] Running devices
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#7751">[ date ]</a>
|
|
<a href="thread.html#7751">[ thread ]</a>
|
|
<a href="subject.html#7751">[ subject ]</a>
|
|
<a href="author.html#7751">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>On Dec 12, 2011, at 12:17 PM, Neal Culiner wrote:
|
|
><i> Anyone see anything wrong with what I’m doing?
|
|
</I>
|
|
No. What API level and device are you having problems on? The following nearly identical code works for me:
|
|
|
|
var recips = new string[] { "<A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">email at example.com</A>" };
|
|
string MessageBody = "This is the message body!";
|
|
var intent = new Intent(Intent.ActionSend);
|
|
intent
|
|
.PutExtra(Intent.ExtraEmail, recips)
|
|
.PutExtra(Intent.ExtraSubject, "Android App Bug Report")
|
|
.PutExtra(Intent.ExtraText, String.Format("{0}\n\n", MessageBody))
|
|
.SetType("application/octet-stream");
|
|
if (File.Exists(filePath))
|
|
{
|
|
Java.IO.File file = new Java.IO.File(filePath);
|
|
var uri = Android.Net.Uri.FromFile (file);
|
|
Log.Info ("*jonp*", "File URI: {0}", uri.ToString ());
|
|
intent.PutExtra(Intent.ExtraStream, uri);
|
|
}
|
|
try
|
|
{
|
|
StartActivity(Intent.CreateChooser(intent, "Send E-mail Using..."));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Info ("*jonp*", "Exception! {0}", ex);
|
|
Toast.MakeText(this, "There are no e-mail clients installed.", ToastLength.Short).Show();
|
|
}
|
|
|
|
The email I received does contain an attachment that contains data.
|
|
|
|
Thanks,
|
|
- Jon
|
|
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="007741.html">[mono-android] Saving a log file and attaching to an e-mail
|
|
</A></li>
|
|
<LI>Next message: <A HREF="007744.html">[mono-android] Running devices
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#7751">[ date ]</a>
|
|
<a href="thread.html#7751">[ thread ]</a>
|
|
<a href="subject.html#7751">[ subject ]</a>
|
|
<a href="author.html#7751">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
|
|
mailing list</a><br>
|
|
</body></html>
|