# read default signature of outlook
private string ReadSignature()
{
# signature directory
string appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\Microsoft\Signatures";
string signature = string.Empty;
DirectoryInfo diInfo = new DirectoryInfo(appDataDir);
if (diInfo.Exists)
{
# list to save file names whose extension is ".htm"
FileInfo[] fiSignature = diInfo.GetFiles("*.htm");
# check whether signature file exists
if (fiSignature.Length > 0)
{
# read signature
StreamReader sr = new StreamReader(fiSignature[0].FullName, Encoding.Default);
signature = sr.ReadToEnd();
if (!string.IsNullOrEmpty(signature))
{
string fileName = fiSignature[0].Name.Replace(fiSignature[0].Extension, string.Empty);
signature = signature.Replace(fileName + "_files/", appDataDir + "/" + fileName + "_files/");
}
}
}
return "<br>" + signature;
}