Forum Discussion

slaugier's avatar
slaugier
Occasional Contributor
6 years ago

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?

  • slaugier's avatar
    slaugier
    6 years ago

    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

  • tristaanogre's avatar
    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.

    • slaugier's avatar
      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