We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Create Mail with SoMailParser and attach a file to mail


i want to create a mail with SO Template in Outlook an atatch an pdf file.

The following script generate a Mail, replace the placeholder in somail an open the mail in Outlook:

set app = wscript.CreateObject("Superoffice.Application")
set doc = app.Database.CreateDocument
doc.Contact = app.Database.GetContact(3)
doc.Person = app.Database.GetPerson(12)
doc.Description = "My Document"
doc.Done = Now
doc.Template = app.GetListItem(130, 388)
doc.Header = "My Letter"
WScript.Echo doc.FullPath
set shell = wscript.CreateObject("wscript.Shell")
shell.Run("""C:\Program Files (x86)\SuperOffice\SuperOffice Mail Link\SoMailParser.exe"" """ & doc.FullPath & """") 

Now i want to attatch a file to the mail, is it possible?


RE: Create Mail with SoMailParser and attach a file to mail

You can try this (it waits until and assumes that somailparser has opened Outlook and the mail message in a visible way to retrieve the active mail message for adding the attachment):

set shell = wscript.CreateObject("wscript.Shell")
shell.Run """C:\Program Files (x86)\SuperOffice\SuperOffice Mail Link\SoMailParser.exe"" """ & doc.FullPath & """", 1, True

set objOutl = wscript.CreateObject("Outlook.Application")
set objMailItem = objOutl.ActiveInspector.CurrentItem

objMailItem.Attachments.Add "d:\temp\myattachment.docx"

set objMailItem = nothing
set objOutl = nothing


Av: Sietse Wielenga 30. apr 2019

RE: Create Mail with SoMailParser and attach a file to mail

Hi Sietse,

thanks a lot for your help, yesterday night i found an simular solution.


i use the "Superoffice.Application" object in vbscript to create a new document and save it to filesystem and open it in outlook. It works very good.


Thanks a lot



Av: Mike Behrendt 30. apr 2019