Micro Focus QTP (UFT) Forums
Outlook using QTP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Outlook using QTP (/Thread-Outlook-using-QTP)

Pages: 1 2


Outlook using QTP - dsharma - 01-21-2008

Hi
I am trying to send a mail using outlook programatically.
Every time the script tries to send mail, outlook brings up a security error message. How to bypass this msg?
Thanks


RE: Outlook using QTP - Rajashekar Gouda - 01-21-2008

Rajashekar Gouda Wrote:[quote=dsharma]
Hi
I am trying to send a mail using outlook programatically.
Every time the script tries to send mail, outlook brings up a security error message. How to bypass this msg?
Thanks

One my colleagues was facing same issue, he used a third party tool to click OK button which was there on error message.

Need to search in Google for the third part tool and it was a freeware.

Regards
Raj


RE: Outlook using QTP - dsharma - 01-21-2008

Thanks but I need to do this without using any third party tool. Is it possible?


RE: Outlook using QTP - Rajashekar Gouda - 01-21-2008

no idea on that yaar


RE: Outlook using QTP - chrism2202 - 01-23-2008

hello,

Basically, you have three choices for scripting emails from QTP;
1. Have QTP access a PHP script that has email functionality.
2. Have QTP use outlook objects to send email.
3. Have QTP create an email object without either of the above.

The first method works, if you can create a PHP page with a script mailer. The downside is, that it uses an web page, but it is effective.

The second method is not ideal, in my opinion. What if the PC you are executing the script on does not have outlook installed? What if the outlook isnt configured with an account? (Bad idea).

The third option seems to be the best and has worked out wonderfully. Sample function code bleow:

'**************** Send Email Function *****************************
Code:
Function SendMail(EmailAddress, MessageBody, MsgAttachment)
    Dim objMessage
    Set objMessage = CreateObject("CDO.Message")
    objMessage.Subject = "QTP Results - Automated Testing"
    objMessage.From = "QTPTesting@address.com" ' Change this for your own from address
    objMessage.To = EmailAddress
    objMessage.TextBody = MessageBody

' ==Include File attachments here ==
    objMessage.AddAttachment MsgAttachment
    
    '==This section provides the configuration information for the remote SMTP server.
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

    '==Name or IP of Remote SMTP Server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "<Server Address Here>"   ' "someserver.domain.com"

    '==Server port (typically 25)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    objMessage.Configuration.Fields.Update

    '==End remote SMTP server configuration section==
    objMessage.Send
End Function

Hope this helps,

Chris


RE: Outlook using QTP - keyurpathak - 04-04-2008

Hi Chris,

I am getting error while using this:

Run Error The transport failed to connect to the server.

Line (25): "objMessage.Send". Failed 4/3/2008 - 16:08:19

Also is there way to use the Quality Center for using the email.

Thanks.


RE: Outlook using QTP - vamshiram - 06-25-2008

sAME MESSAGE FOR ME ...


RE: Outlook using QTP - vamshiram - 06-25-2008

Do u know what is the third party tool

Rajashekar Gouda Wrote:
Rajashekar Gouda Wrote:[quote=dsharma]
Hi
I am trying to send a mail using outlook programatically.
Every time the script tries to send mail, outlook brings up a security error message. How to bypass this msg?
Thanks

One my colleagues was facing same issue, he used a third party tool to click OK button which was there on error message.

Need to search in Google for the third part tool and it was a freeware.

Regards
Raj



RE: Outlook using QTP - navyasatish - 07-18-2008

vamshiram Wrote:Do u know what is the third party tool

Rajashekar Gouda Wrote:
Rajashekar Gouda Wrote:[quote=dsharma]
Hi
I am trying to send a mail using outlook programatically.
Every time the script tries to send mail, outlook brings up a security error message. How to bypass this msg?
Thanks

One my colleagues was facing same issue, he used a third party tool to click OK button which was there on error message.

Need to search in Google for the third part tool and it was a freeware.

Regards
Raj



RE: Outlook using QTP - navyasatish - 07-18-2008

recently i got this problem of having some pop comming up with out look.
we can  either use the simple stuff as mentioned in the below link
http://www.contextmagic.com/express-clickyes/

or

we can use the Blat - A Win32 Command Line mailer.

i opted  BLAT command line mailer.
for this  and it worked fine for me
a)download the blat.exe and blat.dll files on to your system
b) use the systax mentioned  http://www.blat.net and save it as .cmd file  and run that .cmd file (the output which i want to c in a email have saved into textpad and this textpad is called from this )


Let me know if any one wants the information in detail...

Thanks