简体   繁体   中英

How to send customized Outlook email from Bamboo with outlook object? Do we need outlook to be installed in the Bamboo server?

I am running a.js file to send customized outlook email from my local machine eclipse. We need to put customized HTML table in the email and so we are using.js file so that we can change the HTML content from our code before sending the mail every time.

The code in the.js file is as below but the HTML content is not relevant as it can be anything.

Question is - How to send the same from Bamboo as our organization Bamboo server will not have my outlook setup? or is there any other way to do it?

Any suggestion or solution is greatly appreciated.

var theApp = new ActiveXObject("Outlook.Application")
var theMailItem = theApp.CreateItem(0)
theMailItem.to = "test1@test.com";
theMailItem.Subject = "This is subject";
theMailItem.HtmlBody = "<!DOCTYPE html>"
+"<html>"
+"<head>"
+"<title>Example</title>"
+"</head>"
+"<body>"
        +"<table class='myTable'>"
        +"<tr>"
            +"<th>Project</th>"         
        +"</tr>"        
+"</body>"
+"</html>";

theMailItem.send();

The Considerations for server-side Automation of Office article states the following:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

If you use Exchange accounts in Outlook you may consider using EWS or Graph API instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM