Quality Center / ALM Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

Mail via ALM

SOLVED
Go to Solution
Highlighted
Advisor

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
10 REPLIES
Honored Contributor [Founder]

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

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

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

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

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

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

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 [Founder]

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

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 [Founder]

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!]