Hello,
For a few weeks I have been learning Nim. Now, after I learned some basics, I'd like to use it to write actual apps. The one I want to write is for mail sending automation using Outlook. I did similar things using Python in the past and now I wonder how should I approach this in Nim. My Python code looked like this:
import win32com.client
from win32com.client import Dispatch, constants
olMailItem = 0x0
obj = win32com.client.Dispatch("Outlook.Application")
newMail = obj.CreateItem(olMailItem)
newMail.SentOnBehalfOfName = 'mail@mail.com'
newMail.Subject = "Test mail's subject"
newMail.BodyFormat = 2
newMail.HTMLBody = "Test mail's body"
newMail.To = "user1@mail.com"
newMail.CC = "user2@mail.com"
newMail.display()
I believe that in Nim the winim module might be used to achieve the same goal. However, the details on how to use it I found preety poor in details, so I'd like ot ask you how should I rewrite this python code so it'll work for Nim.I havent used COM for a long time and I dont have outlook installed but examples here should help ?
Well, thanks. I managed to write this code and it works:
import winim/com
var obj = CreateObject("Outlook.Application")
var olMailItem = 0x0
var newMail = obj.CreateItem(olMailItem)
newMail.Subject = "test"
newMail.Body = "Bodytest"
newMail.display()
I'll leave it here as somebody might need it in the future.