Outlook email send batch file with arguments (switch parameters) - email

In email I can send
\\amsdev\ams\sub_applications\blueline\icons\blueline_launchmonitor.bat
However, I NEED to be able to send that batch file with switch or parameters
so it looks like this:
\\amsdev\ams\sub_applications\blueline\icons\blueline_launchmonitor.bat -server omsdev -cfg_region dev -blueline 540 -no_desktop_communication
I get error:
"We can't find \\...... .bat -server..... Please make sure your's using the correct location or web address.
What are my options?

Related

Need to send email with Attachment from Matillion Tool

Need to send email with Attachment from Matillion Tool
I have checked SNS Message,Send Email component from Matillion but it does not have attachment option.
I have Error log table into Amazon Redshift and I want to retrieve those records and load into one file on daily basis( can be put on S3/SFTP ) this file I want to add as attachment to email and send it to vendor for further analysis.
Found this : https://metlcommunity.matillion.com/s/question/0D54G00007lwu2DSAQ/send-email-with-attachment-of-errors but couldn't help.
https://metlcommunity.matillion.com/s/question/0D54G00007lwu2DSAQ/send-email-with-attachment-of-errors
Based on this message on the Matillion site, it looks like currently there is no built-in component for sending an email with an attachment, but it is on the product roadmap to add one.
There are some hosted downloadable jobs that can send emails - e.g. this and this. It is not clear if they can handle attachments, but at least the Python code inside them might be helpful..
You can do this with the python component in Matillion.
If the target file is on S3, you can use the python boto3 package to download the file to the matillion server.
Then you can use the smtp package in python to create the email and attach the file.
this is example code to attach a file where the filename is in the variable filename_out
filename_out = "/tmp/" + "myfile.logs"
part = MIMEBase('application', "octet-stream")
part.set_payload(open(filename_out, "rb").read())
encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename=' + filename_out)
message.attach(part)

Sending an e-mail through MATLAB using Microsoft Outlook

I am using the function found at the following blog: https://uk.mathworks.com/matlabcentral/answers/94446-can-i-send-e-mail-through-matlab-using-microsoft-outlook to send e-mails from my Outlook account from the MATLAB editor. It indeed works, and I can also include attachments or pictures etc.
My question is whether it is possible to send a result of another MATLAB function saved and run at the same directory. I tried calling the function like that :
sendolmail('email_address','Subject included',result of a function);
When I run this, a mistake is returned. It seems as if only strings or attachments from my computer can be sent through the function. Any ideas on how results of functions can be added and sent?
No, it's all in HTML format, so you have to save the results to a file or convert the output to an HTML formatted output (could just be a string).

change recipient / attach a file to a sent email in outlook

I've been trying to test something out, basically looking to do one of the following things:
Change name of recipient in a sent file. I've tried using Outlook Spy (great tool) but every time I changed the recipient in PR_DISPLAY_TO_W it returned the following error:
Could not edit the property: HrSetOneProp returned MAPL_E_COMPUTED
Attaching a file to a sent email file. (I don't know if this one is possible, but would be useful if it was.)
I appreciate any responses.
PR_DISPLAY_TO / CC / BCC are computed properties. The store provider updates them whenever recipients list is modified.
Use the MailItem.Recipients collection to modify the recipients.
MailItem.Attachments.Add.

Powershell S/MIME

Currently, each day my business needs to send and encrypted email using MS Outlook. The process works, but obviously the whole 'doing it every day thing' sucks. I've tried looking up ways to automate the process which has helped me solve the surrounding processes, but i still can't find anything, or whip up anything myself which will handle the email side. The flow of events are;
Receive
Encrypted email is received
Email is opened and attachment is dragged to UNC share 1 (repeated for each email recieved)
Attachment is picked up and processed by surrounding script
Send
Browse UNC share 2
Copy 1 of x files to a new email
Set subject as full file name
Select email to be signed/encrypted in top ribbon
Send email and repeat for each file in UNC share 2
I can get emails to send with attachment via powerhsell and by using S/MIME, but once I combine the two I get stuck and the script turns to rubble :(
Any help at all would be greatly appreciated
If I'm not mistaken, Powershell can load and use .NET assemblies, correct? (I'm not a powershell user, so my knowledge is limited).
Given that, I would recommend taking a look at using the MimeKit and MailKit libraries.
Check out the MimeKit README for some examples on how to use the S/MIME API's.
MimeKit comes with a WindowsSecureMimeContext which you might be able to use out of the box, but that depends on where your private keys and certificates are stored. If they aren't in the X509Store, then you could use the TemporarySecureMimeContext and simply load the certificate(s) and private key(s) into that and use it.
Got a similar problem and here's my solution so far, still testing:
$Outlook = New-object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = "me#company.tld"
$Mail.Subject ="Test"
$Mail.Body ="Test Body"
# 0 = nothing, 1 = encrypt, 2 = sign, 3 = both!
$PR_SECURITY_FLAGS = "http://schemas.microsoft.com/mapi/proptag/0x6E010003"
$Mail.PropertyAccessor.SetProperty($PR_SECURITY_FLAGS, 3)
$Mail.Send()
If Outlook is running, everything works fine. But when I start Outlook afterwards, I will find the created Mail in the Outbox without encryption and not signed.
Without Outlook running, the Code would produce an "InvokeMethodOnNull"-Error. Putting a $Mail.Display() before the SetProperty()-Part would take care of that and the buttons seem to be checked in the opening E-Mail, but the result will be the same: Start Outlook and your mail is in Outbox without encryption and not signed.

VBScript to modify email content type

I have incoming email set up for SharePoint 2010, and am sending forms from InfoPath using that method, with SMTP server set up on the SharePoint Server machine. It seems easier than elevating the permissions of an anonymous user with the InfoPath code-behind option. I also tried a custom method of sending the emails but was unable to find a way to send the form data along with the email message using the InfoPath 2010 code-behind option. So, I found another way, using the advice from SharePoint UK's website.
My problem is that while removing the x-mailer header actually solved my problem regarding whole email messages, it did not allow the attached form data to be sent to the library. The message would be imported and then just disappear if I did not have the "Save original e-mail" setting enabled. Inspecting messages in the drop folder I found they had a content type of "multipart/related" and if I edited them with NotePad++ I could change that to "multipart/mixed" and the attached form data would then be imported as desired.
So I went about trying to modify the VB Script to make this happen BUT now nothing happens with the script at all. Clearly I'm doing something wrong with it and VBScript really isn't my area of expertise. Maybe it's just not possible to edit those fields or maybe I need to attack it from a different angle. How can I get my VBScript to edit the content type for these emails?
CODE:
Set shell = CreateObject("WScript.Shell")
shell.LogEvent 4, "starting mail filter"
if instr(iMsg.Fields("urn:schemas:mailheader:content-type"), "related") > 1 then
Dim logMsg = "Mail Type: " & iMsg.Fields("urn:schemas:mailheader:content-type")
Dim tempType = Replace(iMsg.Fields("urn:schemas:mailheader:content-type"), "related", "mixed")
shell.LogEvent 4, iMsg.Fields("urn:schemas:mailheader:content-type")
iMsg.Fields.Delete("urn:schemas:mailheader:content-type")
iMsg.Fields.Item("urn:schemas:mailheader:content-type") = tempType
iMsg.Fields.Update
shell.LogEvent 4, iMsg.Fields("urn:schemas:mailheader:content-type")
end if
shell.LogEvent 4, "end mail filter"
iMsg.DataSource.Save
EventStatus = 0
I looked into this in greater detail and found that the content-type property of an email message is one of the many that is read-only using this particular vbscript library. So, I would have to find some other way of editing the file, and the work involved is more than what it would take to find an alternate solution that skipped email altogether. Therefore, I am abandoning the plan of using email in this case. If you take something away from this, let it be that there are read-only properties for the mail message object in this script.