Send Image As Attachment in SMTP

Hello Guys,

Here I am trying to take a screenshot and save it as a variable SCREENSHOT and attach it in SMTP mail attachment by adding “.tostring” {so the error is gone from the attachment box) is it the right way?

Now when it comes to e=sending the mail it throws an error “Send SMTP Mail Message: Object reference not set to an instance of an object.”

Does it mean the variable is null?

How shall I check whether the screenshot is taken and saved in a variable?

You have to use Take Screenshot into an image variable, then use Save Image to save that image variable to a file, then use the file path in the Send SMTP Mail Message activity to attach it.

There are two fields available

  1. file (Shall I provide the screenshot variable in this)
  2. file name (i don’t think there’s any file name)

File is where you put the variable that comes out of Take Screenshot. File name is where you put the path and filename where you want to save the image.

1 Like

screenshot error

I have tried resolving all the points given in possible solutions yet I am not able to screenshot them. My automation is stuck on 2nd last step.

Hi,

You can use below steps:

  1. Take Screenshot:
    Use the “Take Screenshot” activity to capture the current screen. This activity will produce an image, and you can store it in a variable of type Image.
  2. Save Screenshot to File:
    Use the “Save Image” activity to save the captured screenshot as a file. Provide the image variable from the “Take Screenshot” activity as input to the “Save Image” activity. Also, specify the file path where you want to save the screenshot, combining a folder path, a desired filename, and the file extension (e.g., “.png”).
  3. Send Outlook Email:
    In the “Attach File” property of the “Send Outlook Mail” activity, provide the same file path you used in the “Save Image” activity. This ensures that the screenshot file is attached to the email.

What a coincidence Neha, I was just checking your post on LinkedIn and do drop the answer here :sweat_smile:

Let me try with your answer.

screenshot error

This is the error I am getting, even though I checked with selectors it is proper.

Hi @Anirudh_Tugawe ,
I have created one video and publish in youtube, Please try to watch still facing any issue will go for a call via zoom.
Vidoe Link:- https://youtu.be/p0gH0TbPCjs
#techystack
Regards,
Pavan Kumar

1 Like

Well now your problem is the selector for Take Screenshot is not correct. Do you need a screenshot of a specific element on the screen, or just the entire screen? If the entire screen is what you want, then use the classic Take Screenshot with no selector.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.