Showing posts with label email. Show all posts
Showing posts with label email. Show all posts

Sunday, May 13, 2012

Android - Send Email From Your App


/* Create the Intent */
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
/* Fill it with Data */
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"to@email.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");
/* Send it off to the Activity-Chooser */
context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));

Emails only works if you are using the application in a real phone, so if you are using the emulator, try it on a real phone.

Wednesday, August 10, 2011

How to Find All Email Address in a Text File





using System.Text.RegularExpressions;
using System.IO;

string FileData = File.ReadAllText(fileName);

Regex emailregex = new Regex("(?<user>[^@]+)@(?<host>.+)");
MatchCollection matches = emailregex .Matches(FileData);
foreach (Match match in matches)
{
      Console.WriteLine(match.Value.ToString());
}