Script to Send Email

I’ve done some digging, but haven’t found anything.

Is there some sample script I can use to send an email through the already configured settings in Dundas? Ideally I’d like to be able to specify the To, Subject & Body in the script, but shouldn’t need anything else.

Thanks.

I would like to point out, that the IEmailService interface is part of the .net API, and not available in JavaScript.

So it’s only possible if you create implement it in .NET as a Dundas BI server extension, see the documentation here:

http://www.dundas.com/support/api-docs/net/#html/T_Dundas_BI_Services_IEmailService.htm%3FTocPath%3DLanguage%20Reference|Dundas.BI.Core%20Assembly|Dundas.BI.Services|IEmailService%20Interface|_____0

If you need to use JavaScript, you may use JavaScript to open the prefilled email message:

window.open(‘mailto:test@test.com?subject=subject&body=body’);

But it’s not automated, it will simply open up the email application with pre-filled information.

Please note, the email functionality isn’t exposed in REST or JS deliberately because it would allow any arbitrary users to send emails from the server, and this would be regarded as a security issue.

I have written a script that extracts certain information about the user accessing our site & returns string data, that I want email internally (under certain conditions I’d build in).

I know the application has settings & I’ve set-up my SMTP server, so my initial thought was to somehow use that & just define the to/subject/body. If I can’t, I’m open to other ways to do this.

You might try to use a notification. I think that in your case you do not want an attached content. It might be possible to override the content parameter in the rest call with an empty object but I have not tried that myself.

I do use notifications with the rest api and python with pydundas: https://github.com/Web-Power/pydundas/blob/master/pydundas/examples/notifications.py where I set to, body and subject. It might be a start for you.