Skip to content

Commit

Permalink
Merge pull request saucepleez#152 from saucepleez/development-branch
Browse files Browse the repository at this point in the history
Minor Iteration to 3.2.1.0
  • Loading branch information
saucepleez authored Sep 3, 2019
2 parents 6e04d04 + 868078a commit 9dc351b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
21 changes: 20 additions & 1 deletion taskt/Core/Automation/Commands/SMTPSendEmailCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ public class SMTPSendEmailCommand : ScriptCommand
[Attributes.PropertyAttributes.SampleUsage("**Everything ran ok at [DateTime.Now]**")]
[Attributes.PropertyAttributes.Remarks("")]
public string v_SMTPBody { get; set; }

[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Attachment Path (Optional)")]
[Attributes.PropertyAttributes.PropertyUIHelper(Attributes.PropertyAttributes.PropertyUIHelper.UIAdditionalHelperType.ShowVariableHelper)]
[Attributes.PropertyAttributes.InputSpecification("Indicates the file path to attachment.")]
[Attributes.PropertyAttributes.SampleUsage("**c:\\temp\\file.txt**")]
[Attributes.PropertyAttributes.Remarks("")]
public string v_SMTPAttachment { get; set; }
public SMTPSendEmailCommand()
{
this.CommandName = "SMTPCommand";
Expand All @@ -93,14 +101,24 @@ public override void RunCommand(object sender)
string varSMTPToEmail = v_SMTPToEmail.ConvertToUserVariable(sender);
string varSMTPSubject = v_SMTPSubject.ConvertToUserVariable(sender);
string varSMTPBody = v_SMTPBody.ConvertToUserVariable(sender);
string varSMTPFilePath = v_SMTPAttachment.ConvertToUserVariable(sender);

var client = new SmtpClient(varSMTPHost, int.Parse(varSMTPPort))
{
Credentials = new System.Net.NetworkCredential(varSMTPUserName, varSMTPPassword),
EnableSsl = true
};

client.Send(varSMTPFromEmail, varSMTPToEmail, varSMTPSubject, varSMTPBody);
var message = new MailMessage(varSMTPFromEmail, varSMTPToEmail);
message.Subject = varSMTPSubject;
message.Body = varSMTPBody;

if (!string.IsNullOrEmpty(varSMTPFilePath))
{
message.Attachments.Add(new Attachment(varSMTPFilePath));
}

client.Send(message);
}
public override List<Control> Render(frmCommandEditor editor)
{
Expand All @@ -115,6 +133,7 @@ public override List<Control> Render(frmCommandEditor editor)
RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_SMTPToEmail", this, editor));
RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_SMTPSubject", this, editor));
RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_SMTPBody", this, editor));
RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_SMTPAttachment", this, editor));

return RenderedControls;

Expand Down
1 change: 1 addition & 0 deletions taskt/Core/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ private static bool CommandEnabled(Type cmd)
systemVariableList.Add(new Core.Script.ScriptVariable { VariableName = "PC.DomainName", VariableValue = Environment.UserDomainName });
systemVariableList.Add(new Core.Script.ScriptVariable { VariableName = "Env.ActiveWindowTitle", VariableValue = Core.Automation.User32.User32Functions.GetActiveWindowTitle() });
systemVariableList.Add(new Core.Script.ScriptVariable { VariableName = "taskt.EngineContext", VariableValue = "{JsonContext}" });
systemVariableList.Add(new Core.Script.ScriptVariable { VariableName = "taskt.Location", VariableValue = System.Reflection.Assembly.GetEntryAssembly().Location });
systemVariableList.Add(new Core.Script.ScriptVariable { VariableName = "Loop.CurrentIndex", VariableValue = "0" });
return systemVariableList;
}
Expand Down
2 changes: 1 addition & 1 deletion taskt/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.0.*")]
[assembly: AssemblyFileVersion("3.2.0.0")]
[assembly: AssemblyFileVersion("3.2.1.0")]
//[assembly: AssemblyVersion("0.0.0.2")]
//[assembly: AssemblyFileVersion("0.0.0.2")]

0 comments on commit 9dc351b

Please sign in to comment.