Ask a Question

Can I send a mail from any account through BuiltIn.SendMail() ?

giriprasasd100
Occasional Contributor

Can I send a mail from any account through BuiltIn.SendMail() ?

Hi,



I am using TestComplete 7.52 version.



I need to send email at the end of test execution using BuiltIn.SendMail().



I find that we can send email from any configured user email id to any other id... ie., I can send a mail to me from my manager's email account by just passing the suitable parameters to the sendmail function.



How this particular function works and verifies whether the user has credentials? Or only by his email credential the mail is sent ?



Thanks & Regards,

Giri Prasad


7 REPLIES 7
Madhi
Contributor


Sub Send_Mail(to_emailid, cc_emailid)

Set objOutlook = CreateObject("Outlook.Application")

Set objOutlookMsg = objOutlook.CreateItem(0)

With objOutlookMsg

.To = to_emailid

.Cc = cc_emailid

.Subject = "Test Complete Script Execution Details"

.Body = "Error Occured in : "

'.HTMLBody = "HTML version of message"

'.Attachments.Add ("f:\Test.txt")

.Send

End With

Set
objOutlookMsg = Nothing

Set
objOutlook = Nothing

End
Sub

I use this function.


giriprasasd100
Occasional Contributor

Hi Madhi,



Thanks for your post...



I am aware we can use "Outlook.Application" object to send mail (also the general CDO object implementation).



But when we use Outlook object, Windows may prompt the an confirmation dialog to the user which we need to handle(Attached the screen shot).

It is relatively slow compared to BuildIn.SendMail method...



My doubt is how the BuildIn.SendMail() method accessing the sender's mail account (credentials) even when he is not actually the current logged in user !



Won't you consider as a security issue ?



Thanks & Regards,

Giri Prasad






Hi Giri,


How this particular function works and verifies whether the user has credentials?


A user's account is determined by the default MAPI provider - it uses a sender's e-mail address to do this.


I recommend that you see the "Send an e-mail message" article and the "Sending E-Mail From Scripts" help topic - they contain script examples that can be useful for you.


Best regards,
Alexey

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
jeeejay
Contributor

Hi,



Do you have Outlook 2003 installed? I used to get that dialog with it ... with Outlook 2007, you will be able to send e-mails with the function mentioned above without any confirmation dialogs



-GJ 
giriprasasd100
Occasional Contributor

G J,

Yes I am using Outlook2003 while getting this confirmation prompt. I will try to change the Outlook settings to avoid it.



Allen,

Yes I understand the working of SendMail function. But I am bothered about sending mail through someone account just by knowing his/her email username.

For Example:

SendMail("MyEmailId","MyMailDomain","MyManagerName","MyManagerEmailId","Mail-Subject","Mail-Content")



This statement is absolutely correct and I am getting a mail from my manager(as per the parameter defined)...

Now security issue is I can have my own subject and use this function to get it from my manager mail account without knowing his mail credentials.



Similar case may happen to me, just by getting my email username anyone can get a mail from me without my credentials !!!



Now how you take this?



Thanks & Regards,

Giri Prasad

 
Pakema
Contributor

As for me, simple solution of this problem is write self extention, f.e. exe-file with the same params.

Hi Giri,


You can try using a script extension to store a password and a login. To learn how to implement this, see the "Work with encrypted data storage" article.


Best regards,
Alexey

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: