Mail via ALM (7176 Views)
Reply
Advisor
PeterBHansen
Posts: 46
Registered: ‎11-01-2013
Message 1 of 11 (7,176 Views)
Accepted Solution

Mail via ALM

Fellow sufferers!

I want to send a mail from the VBA script in the post-processing of a report. I do not have Outlook on the ALM server or anywhere I can use. I want to use whatever ALM is using to send its mails. This is set up by the ALM admin, and I want to use that

Best wishes, Peter B. Hansen
Honored Contributor
Jan Czajkowski
Posts: 2,113
Registered: ‎12-12-2007
Message 2 of 11 (7,143 Views)

Re: Mail via ALM

I assume you are referring to an Excel report? From the post-processing part it is possible to open a session toward the ALM server. Then you can use the SendMail method of the TDConnection object.
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
Advisor
PeterBHansen
Posts: 46
Registered: ‎11-01-2013
Message 3 of 11 (7,125 Views)

Re: Mail via ALM

Hi Jan,

 

could you please give a simple example, I'am new to ALM and VBA.

 

Best wishes, Peter B. Hansen

Advisor
PeterBHansen
Posts: 46
Registered: ‎11-01-2013
Message 4 of 11 (7,121 Views)

Re: Mail via ALM

I tried this code:

 

TDConnection.SendMail "fmt-la-ftk02@fiin.dk", "Subject", "Description", NULL, "TEXT"

 

And it gave the attached error message when I ran it (Danish text translates into: "Type mismatch").

Honored Contributor
Trudy Claspill
Posts: 3,712
Registered: ‎09-09-2010
Message 5 of 11 (7,110 Views)

Re: Mail via ALM

You are missing a parameter value; either SendTo or SendFrom.

Public Sub SendMail( _
ByVal SendTo As String, _
Optional ByVal SendFrom As String = "", _
Optional ByVal Subject As String = "", _
Optional ByVal Message As String = "", _
Optional ByVal attachArray As Variant, _
Optional ByVal bsFormat As String = "" _
)
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
Advisor
PeterBHansen
Posts: 46
Registered: ‎11-01-2013
Message 6 of 11 (7,092 Views)

Re: Mail via ALM

Hi Trudy,

 

That solved the problem, but could you please also give an example, what it looks like if I want to mail to more than one recipient and more than one cc?

 

Thank you.

 

Peter B. Hansen

Advisor
PeterBHansen
Posts: 46
Registered: ‎11-01-2013
Message 7 of 11 (7,089 Views)

Re: Mail via ALM

Hi Jan

 

Please show how to open a session towards ALM?

 

My code TDConnection.SendMail... only works in the workflow script, but not in my post processing. Is that because I need to open a session in the (Excel) post processing?

 

Best wishes,

 

Peter B. Hansen

Honored Contributor
Trudy Claspill
Posts: 3,712
Registered: ‎09-09-2010
Message 8 of 11 (7,081 Views)

Re: Mail via ALM

Examples are available in the OTA API reference documents. Look up the TDConnection object, then drill down on the SendMail method.

As noted in that documentation, they do not provide access to the CC field for sending emails; only the To and From fields.
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
Honored Contributor
Jan Czajkowski
Posts: 2,113
Registered: ‎12-12-2007
Message 9 of 11 (7,071 Views)

Re: Mail via ALM

You have to open an external session from the post-processing. Like this:

 

Set tdc = CreateObject("tdapiole80.tdconnection")
tdc.InitConnectionEx (http://servername:8080/qcbin) 
tdc.Login "abc", "def"
tdc.SendMail ...

 So you need to think about the potential security problem of hardcoding the password - perhaps it is OK if you create a user with minimal permissions.

 

You can list several receiver email adresses and separate them by semicolon or comma. It is also possible to send email to a whole user group, for example "[TDAdmin]".

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
Advisor
PeterBHansen
Posts: 46
Registered: ‎11-01-2013
Message 10 of 11 (7,062 Views)

Re: Mail via ALM

Hi Jan

 

Thanks for the answer. Just for clarification: why is there a difference between mailing from the workflow and from post-processing? Making use of ALMs already configured mail connection seems so elegant, and if I can do it from the workflow, why not from the post processing?!!

 

Best wishes, Peter B. Hansen

Honored Contributor
Jan Czajkowski
Posts: 2,113
Registered: ‎12-12-2007
Message 11 of 11 (7,057 Views)

Re: Mail via ALM

When you are entering the Excel generator you are leaving the scope of your ALM session. You are accessing ALM  from another entry point, where you can make SQL requests directly toward the database and leverage features of Excel.

 

So it is somewhat similar to when you enter Customize in the project. It is basically an external application that is bundled with the ALM project.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.