ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Composing Outlook e-mail with python script

Hi everyone,

 

I'm trying to compose and open new mail window in Outlook that is ready for sending using python script, but I run into dead end with error 1050 when executing.

 

The py code is shown on pic below and everything is working when I run it in Spyder

Spyder.JPG

 

But when I try to run same code in LV I get error message:

LV.JPG

I searched for solution online and find some examples like "pip install pywin32":

Postupak.png

 

That didn't help... I was trying to use different python dlls and that didn't help either. I don't have ideas what to do next. Can someone please help me with this problem?

0 Kudos
Message 1 of 5
(2,724 Views)

Hi,

I recommand a better solution for your project :

you could save the python code to a py file, and use the system Exec.vi (windows command line ) to run the python file.

you find attached the LabVIEW Code + python file ,and a video that preuve the Result.

Best Regards.

thank you.

 

 

Download All
0 Kudos
Message 2 of 5
(2,681 Views)

Hi, thank you for help.

 

I did try that first but I have another problem with that solution. I do not know how to code in python very well (you could say I'm total beginner). The e-mail im trying to send looks like this:

 

Email.png

 

 

I have a table with some data in it and I do not know how to input table data to py script so I had "genious" idea to write whole script (python code, html and data for table, a whole code) as string (because I can easily change strings) and run that whole script like I showed in first post. And I got stucked

 

P.S. Can you please save VI for version 18.0. I can not open it. Ty

0 Kudos
Message 3 of 5
(2,644 Views)

Hi,

you find attached the 2018 version ?

why you don`t use the SMTP mail ?

0 Kudos
Message 4 of 5
(2,631 Views)

Hi,

this is a solution for your problem using SMTP Email .

you need to make sur that email account allow less security apps.

using set attachment.vi you could attach any file that you want to send.

you find below a video + software.

best Regards.

thank you.

 

Emna20_1-1650264697077.png

Emna20_2-1650264951869.png

kudos 🤗

 

0 Kudos
Message 5 of 5
(2,622 Views)