Mailman

Mailman

Mailman is published! A minimal interop package for sending emails, task requests or creating contacts in Outlook using Dynamo.

Obviously you first need to have Outlook installed on your computer and signed in to your account in Outlook. This package is tested on Outlook 16 and Dynamo 1.3 - 2.0. However should work with previous versions of Outlook as well.

20 Likes

Tried this package this works well…! thanks for the share.
Was printing a pdf and trying a mail it to self. everything works well except that the save window appears on the screen and has to manually save the pdf before emailing it
Is there any way to get rid of the save window or any way to autosave given the file path?

Note: Thought its worth to post it here rather a new thread, sorry if it not the way to go about it.

1 Like

Hi @saju_autodesk

The problem you are facing is totally irrelevant to Mailman. You need to change your PDF printer settings.

Printing PDFs can be frustrating based on what virtual printer you are using.
But most of PDF printers have got some settings in the line of “prompt for file name” which you can disable. Then your PDFs will be printed and saved without the save dialog popping up.

Some of them might be trickier to set and involves changing the registry key. Have a look at this: http://archi-lab.net/printing-pdfs-from-revit-why-is-it-so-hard/ if you want to do that programmatically. However that can be done using Python as well as opposed to C# which is shown in the link. Another thing worth being aware of is that PDFs can take time to be saved. That means the file in the given path might not be available for Mailman nodes when it is looking for it. You can use this Python code to delay this process until the file becomes available:

import clr
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')

import os
from os import path

from System.Threading import Thread


pdfFilePath = IN[0]

while not path.exists(pdfFilePath):
	Thread.Sleep(500)
	
OUT = pdfFilePath
3 Likes

@HossZamani, this is great, thanks for sharing. Is there a way to turn a list of items in Dynamo into a list of items in the email body (multi-line lists). I tried separating lists with “\r\n” and I could see it working in Dymamo but it didn’t work in the email message. Any ideas?

So you have a list of strings that you want to concatenate and feed to MailBody input? Which BodyFormat are you using?

That’s correct. So I would like to have the email produce a concatenated list (bulleted if possible but not absolutely necessary):

  • List item 1
  • List item 2
  • List item 3
  • Etc.

Instead it’s looking like this in the email message:

List item 1, List item 2, List item 3, Etc.
I’m using html. Thanks!

Try this:

Mailbody_BulletPoint.dyn (25.7 KB)

This is looking great, thanks @HossZamani!
Here’s another challenge I’m having. I’m trying to run a list of lists through your Python node and it’s not working. Ultimately my goal is to send a customized bulleted list to individual coworkers on the project. So Bill gets this list:

  • List item 1
  • List Item 2
  • List Item 3

and Sally gets this list:

  • List item 4
  • List item 5

I think I have everything else working but it’s hung up in the python node.

@HossZamani, this is the problem I’m having. Can it be resolved?

Sure it can!

Just remember that you need your Outlook to be open if you want to send emails to multiple addresses.

Here’s the dyn file (for some reason I can’t copy paste the Python code):
Mailbody_BulletPoint2.dyn (20.1 KB)

2 Likes

I now get multiple emails but it seems as though there is something wrong with the bulleted list. I might be missing something but this is what my email looks like, multiple blank bullet points (there should only be 2, “Test 1” and “Test 3”).

Capture

Can you share your dyn file or a screenshot. I can’t figure out anything from this, but I suspect you are not prepping your mailbody properly. Essentially what we are doing is just making an html file. See here for more about structuring html files:

You’re right, it was a problem on my end. That link was very helpful (not an expert here).
I am having one small issue. Every time I open the dyn file the Action Type node doubles up the outputs (see below). I hit run and it doesn’t work. I have to replace the node before it will work. Is it a problem on my end as well?

Capture

No, I’m having this problem too. Not sure what’s changed as this wasn’t happening before. I have to fix it and upload a new version of the package. For the time being see what string value actually comes out of the node in question. You can replace the node by manually typing that string value and feeding it to the Outlook._Email node.

How to attach file ? Can you please help ?

Thanks for this package, one question though, how would I add an image to the body of the email (not an attached image)? I can add the image, but it is just showing a white rectangle for the image, rather than content.

Hello!

It’s my first time using dynamo and i have some problems sending a serie of emails with mailman package.
I want to send a x number of emails which have to take the first element of a list as a mailbody and the first element of another list as a subject, then the second element of both lists… until the end of both lists. Could I do that?

I think I got the right nodes but it only sends the first mail, for the rest of them appears that message: HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

Hi @ctalarn, this may be because you don’t have your Outlook open. If you want to send multiple emails, Outlook needs to be open on your computer. Hope this helps.

1 Like

Hi @TomC, the image source needs to be an actual image file path on disc. Seems like you are feeding an image object (System.Drawing.Bitmap) instead.