Ask a Question

Everytime I send an e-mail I have a smart card windows prompt

SOLVED
slaugier
Occasional Contributor

Everytime I send an e-mail I have a smart card windows prompt

Hi

 

I recently needed to install a smart card reader for another project.
And now, everytime, I use the sendmail function, I get a windows security prompt saying "connect a smart card".


The only way to use the function to send email now is to have the smart card reader connected, which is very inconvenient. I  use CDO to send mail.
The prompt appears when mMessage.Send() is being processed in this function :

function SendEmail(mFrom, mTo, mSubject, mBody, mAttach) 
{ 
var schema, mConfig, mMessage; 

schema = "http://schemas.microsoft.com/cdo/configuration/"; 
mConfig = getActiveXObject("CDO.Configuration"); 

mConfig.Fields.$set("Item", schema + "sendusing", 2); // cdoSendUsingPort 

mConfig.Fields.$set("Item", schema + "smtpserver", "smtp.office365.com"); 

mConfig.Fields.$set("Item", schema + "smtpserverport", 25); 

mConfig.Fields.$set("Item", schema + "smtpauthenticate", 1); // Authentication mechanism 

mConfig.Fields.$set("Item", schema + "sendusername", "my_email_adress.com"); 

mConfig.Fields.$set("Item", schema + "sendpassword", "***"); 

mConfig.Fields.$set("Item", schema + "smtpusessl", true); 

mConfig.Fields.Update(); 

mMessage = getActiveXObject("CDO.Message"); 
mMessage.Configuration = mConfig; 
mMessage.From = mFrom; 
mMessage.To = mTo; 
mMessage.Subject = mSubject; 
mMessage.HTMLBody = mBody; 
//mMessage.HTMLBody.Charset = "utf-8"; 

if (mAttach != undefined) 
{ 
mMessage.AddAttachment(mAttach); 
} else 
{ 
mAttach = ""; 
} 

mMessage.Send(); 

Log.Message("Message to <" + mTo + "> was successfully sent"); 
return true; 
} 



Do you have any idea to solve this problem?

2 REPLIES 2
tristaanogre
Esteemed Contributor

This is most likely not a problem with your code but with the general environment.  There is probably something involved in the Smart Card reader drivers and software that when an authentication is being performed, the smart card needs to be present.  TestComplete doesn't really do anything deliberate with Smart Cards or anything.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
slaugier
Occasional Contributor

I don't have the prompt anymore : I had to delete My personal certificates. 

 

Use certmgr.msc in cmd prompt

Go to Personal/Certificates

And delete those which makes trouble

 

Hope it will help someone one day

 

Sylvain

cancel
Showing results for 
Search instead for 
Did you mean: