mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 05:23:24 -07:00
Changed the EmailDestination to work if Outlook is installed as MAPI client but the Outlook plugin is not installed. Also made some progress on the MAPI Recipient properties, but this still doesn't work.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2486 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
c188ad10e8
commit
8980a505b1
2 changed files with 26 additions and 11 deletions
|
@ -55,10 +55,16 @@ namespace Greenshot.Helpers {
|
|||
public static void SendImage(string fullPath, string title) {
|
||||
MapiMailMessage message = new MapiMailMessage(title, null);
|
||||
message.Files.Add(fullPath);
|
||||
message._recipientCollection.Add(new Recipient(conf.MailApiTo, RecipientType.To));
|
||||
message._recipientCollection.Add(new Recipient(conf.MailApiCC, RecipientType.CC));
|
||||
message._recipientCollection.Add(new Recipient(conf.MailApiBCC, RecipientType.BCC));
|
||||
message.ShowDialog();
|
||||
if (!string.IsNullOrEmpty(conf.MailApiTo)) {
|
||||
message._recipientCollection.Add(new Recipient(conf.MailApiTo, RecipientType.To));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(conf.MailApiCC)) {
|
||||
message._recipientCollection.Add(new Recipient(conf.MailApiCC, RecipientType.CC));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(conf.MailApiTo)) {
|
||||
message._recipientCollection.Add(new Recipient(conf.MailApiBCC, RecipientType.BCC));
|
||||
}
|
||||
message.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
@ -251,7 +257,9 @@ namespace Greenshot.Helpers {
|
|||
|
||||
// Check for error
|
||||
if (errorCode != MAPI_CODES.SUCCESS && errorCode != MAPI_CODES.USER_ABORT) {
|
||||
_LogErrorMapi(errorCode);
|
||||
string errorText = GetMapiError(errorCode);
|
||||
LOG.Error("Error sending MAPI Email. Error: " + errorText + " (code = " + errorCode + ").");
|
||||
MessageBox.Show(errorText, "Mail (MAPI) destination", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -350,7 +358,7 @@ namespace Greenshot.Helpers {
|
|||
/// <summary>
|
||||
/// Logs any Mapi errors.
|
||||
/// </summary>
|
||||
private void _LogErrorMapi(MAPI_CODES errorCode) {
|
||||
private string GetMapiError(MAPI_CODES errorCode) {
|
||||
|
||||
string error = string.Empty;
|
||||
|
||||
|
@ -437,8 +445,7 @@ namespace Greenshot.Helpers {
|
|||
error = "MAPI Invalid parameter.";
|
||||
break;
|
||||
}
|
||||
|
||||
LOG.Error("Error sending MAPI Email. Error: " + error + " (code = " + errorCode + ").");
|
||||
return error;
|
||||
}
|
||||
#endregion Private Methods
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue