Closed dmjones closed 9 years ago
Actually, the issue is reproducible in BETA-36. The first time I opened the mail, it tried to automatically decrypt it. I cancelled that and disabled automatic decryption and verification. I close the email and re-opened and the decrypt button was enabled. I restarted Outlook and then opened the email and the button was disabled.
In BETA-35 I currently cannot reproduce it at all.
After upgrading to Beta-38 to fix issue 18, there seems to be occasional oddness with the decrypt button state.
I keep getting encrypted emails which when opened don't give me the option to decrypt.
If I go through my inbox and find another encrypted email and decrypt that, then the decrypt button on the original email suddenly becomes active.
Having a hard time making this reproducible... as it seems very similar symptoms to dmjones500's I add my comments here.
Its probably worth pointing out that this issue seems to be getting worse, or at least far more noticable. Regulally having issues with it leaving the decrypt button greyed out and the only fix seems to be hunting down another encrypted email (that it actually likes), decrypting that and then finding the button re-enabled ont he first encrypted email I'm trying to read.
Still failing to find an email that fails consistantly, though.
I had a similar issue with the last release and outlook 2010.
I build the current trunk version and added debug info. This way I found out that the following line:
var contentType = mailItem.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/content-type/0x0000001F");
is throwing an Exception:
The property "http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/content-type/0x0000001F" is unknown or cannot be found.
I changed false
into true
in this line as a workaround for now:
ribbon.DecryptButton.Enabled = ribbon.VerifyButton.Enabled = true;
I was able to fix my problem with the following function:
private string ReadContentType(Outlook.MailItem mailItem)
{
object contentType = null;
try
{
contentType = mailItem.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/content-type/0x0000001F");
}
catch (Exception ex)
{
object[] schemanames = {"http://schemas.microsoft.com/mapi/proptag/0x007D001F"};
object[] allProperties = mailItem.PropertyAccessor.GetProperties(schemanames);
string allHeaders = (string) allProperties[0];
foreach (var str in allHeaders.Split(new[] {"\r\n", "\n"}, StringSplitOptions.None))
{
const string strContentType = "Content-Type: ";
if (str.StartsWith(strContentType))
contentType = str.Substring(strContentType.Length);
}
}
return (string) contentType;
}
After using this function (on two locations) to get the content-type, the buttons were working again properly. (Except for pgp-mime).
But there might be something strange with my outlook installation. It seems to send (some?) plain text messages as rtf (with a winmail.dat attachment). I don't know if that is related.
Thanks for the code, super helpful!
This will be in release 41.
When I open encrypted email I find the Verify and Decrypt buttons are greyed-out/unavailable. If I copy/paste the email contents to a file, I can successfully decrypt the message using gpg on the command line.
This problem doesn't exist in BETA-35 or BETA-36.