mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Changes for feature request #3542622: added the EmailSubjectPattern, EmailTo, EmailCC, EmailBCC fields.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1947 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
a2f51c9758
commit
d3c3d254b0
4 changed files with 27 additions and 7 deletions
|
@ -223,7 +223,7 @@ namespace Greenshot.Destinations {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, captureDetails.Title, attachmentName);
|
OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, FilenameHelper.FillPattern(conf.EmailSubjectPattern, captureDetails, false), attachmentName, conf.EmailTo, conf.EmailCC, conf.EmailBCC);
|
||||||
}
|
}
|
||||||
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description));
|
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description));
|
||||||
surface.Modified = false;
|
surface.Modified = false;
|
||||||
|
|
|
@ -283,7 +283,7 @@ namespace Greenshot.Interop.Office {
|
||||||
/// <param name="outlookApplication"></param>
|
/// <param name="outlookApplication"></param>
|
||||||
/// <param name="tmpFile"></param>
|
/// <param name="tmpFile"></param>
|
||||||
/// <param name="captureDetails"></param>
|
/// <param name="captureDetails"></param>
|
||||||
private static void ExportToNewEmail(IOutlookApplication outlookApplication, EmailFormat format, string tmpFile, string subject, string attachmentName) {
|
private static void ExportToNewEmail(IOutlookApplication outlookApplication, EmailFormat format, string tmpFile, string subject, string attachmentName, string to, string CC, string BCC) {
|
||||||
Item newItem = outlookApplication.CreateItem(OlItemType.olMailItem);
|
Item newItem = outlookApplication.CreateItem(OlItemType.olMailItem);
|
||||||
if (newItem == null) {
|
if (newItem == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -291,7 +291,16 @@ namespace Greenshot.Interop.Office {
|
||||||
//MailItem newMail = COMWrapper.Cast<MailItem>(newItem);
|
//MailItem newMail = COMWrapper.Cast<MailItem>(newItem);
|
||||||
MailItem newMail = (MailItem)newItem;
|
MailItem newMail = (MailItem)newItem;
|
||||||
newMail.Subject = subject;
|
newMail.Subject = subject;
|
||||||
newMail.BodyFormat = OlBodyFormat.olFormatHTML;
|
if (string.IsNullOrEmpty(to)) {
|
||||||
|
newMail.To = to;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(CC)) {
|
||||||
|
newMail.CC = CC;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(BCC)) {
|
||||||
|
newMail.BCC = BCC;
|
||||||
|
}
|
||||||
|
newMail.BodyFormat = OlBodyFormat.olFormatHTML;
|
||||||
string bodyString = null;
|
string bodyString = null;
|
||||||
// Read the default signature, if nothing found use empty email
|
// Read the default signature, if nothing found use empty email
|
||||||
try {
|
try {
|
||||||
|
@ -384,12 +393,12 @@ namespace Greenshot.Interop.Office {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tmpfile">The file to send, do not delete the file right away!</param>
|
/// <param name="tmpfile">The file to send, do not delete the file right away!</param>
|
||||||
/// <returns>true if it worked, false if not</returns>
|
/// <returns>true if it worked, false if not</returns>
|
||||||
public static bool ExportToOutlook(EmailFormat format, string tmpFile, string subject, string attachmentName) {
|
public static bool ExportToOutlook(EmailFormat format, string tmpFile, string subject, string attachmentName, string to, string CC, string BCC) {
|
||||||
bool exported = false;
|
bool exported = false;
|
||||||
try {
|
try {
|
||||||
using (IOutlookApplication outlookApplication = GetOrCreateOutlookApplication()) {
|
using (IOutlookApplication outlookApplication = GetOrCreateOutlookApplication()) {
|
||||||
if (outlookApplication != null) {
|
if (outlookApplication != null) {
|
||||||
ExportToNewEmail(outlookApplication, format, tmpFile, subject, attachmentName);
|
ExportToNewEmail(outlookApplication, format, tmpFile, subject, attachmentName, to, CC, BCC);
|
||||||
exported = true;
|
exported = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,10 @@ namespace Greenshot.Interop.Office {
|
||||||
string SenderName { get; }
|
string SenderName { get; }
|
||||||
DateTime SentOn { get; }
|
DateTime SentOn { get; }
|
||||||
OlBodyFormat BodyFormat { get; set; }
|
OlBodyFormat BodyFormat { get; set; }
|
||||||
}
|
string To { get; set; }
|
||||||
|
string CC { get; set; }
|
||||||
|
string BCC { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
// See: http://msdn.microsoft.com/en-us/library/ff869026.aspx
|
// See: http://msdn.microsoft.com/en-us/library/ff869026.aspx
|
||||||
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.appointmentitem.aspx
|
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.appointmentitem.aspx
|
||||||
|
|
|
@ -103,7 +103,15 @@ namespace GreenshotPlugin.Core {
|
||||||
|
|
||||||
[IniProperty("OutlookEmailFormat", Description = "Default type for emails. (Text, HTML)", DefaultValue="HTML")]
|
[IniProperty("OutlookEmailFormat", Description = "Default type for emails. (Text, HTML)", DefaultValue="HTML")]
|
||||||
public EmailFormat OutlookEmailFormat;
|
public EmailFormat OutlookEmailFormat;
|
||||||
[IniProperty("OutlookAllowExportInMeetings", Description = "Allow export in meeting items", DefaultValue="False")]
|
[IniProperty("EmailSubjectPattern", Description = "Email subject pattern, works like the OutputFileFilenamePattern", DefaultValue = "${title}")]
|
||||||
|
public string EmailSubjectPattern;
|
||||||
|
[IniProperty("EmailTo", Description = "Default value for the to", DefaultValue = "")]
|
||||||
|
public string EmailTo;
|
||||||
|
[IniProperty("EmailCC", Description = "Default value for the CC", DefaultValue = "")]
|
||||||
|
public string EmailCC;
|
||||||
|
[IniProperty("EmailBCC", Description = "Default value for the BCC", DefaultValue = "")]
|
||||||
|
public string EmailBCC;
|
||||||
|
[IniProperty("OutlookAllowExportInMeetings", Description = "Allow export in meeting items", DefaultValue = "False")]
|
||||||
public bool OutlookAllowExportInMeetings;
|
public bool OutlookAllowExportInMeetings;
|
||||||
|
|
||||||
[IniProperty("OutputFileCopyPathToClipboard", Description="When saving a screenshot, copy the path to the clipboard?", DefaultValue="true")]
|
[IniProperty("OutputFileCopyPathToClipboard", Description="When saving a screenshot, copy the path to the clipboard?", DefaultValue="true")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue