Attaching A Screen CaptureScreen File To An E-Mail

I want to take a screenshot of my SUT at certain points in a test and e-mail that screenshot.

I’ve set a variable to the pathname/filename I want for the captured image:
put “…/…/CaptureResult.tiff” into myCapture

The screen capture takes place and the .TIFF file is created in the right place.

My SMTP line looks like this:
sendmail(smtp_host:“”, smtp_type:“Login”, smtp_user:"", smtp_password:“xxx”, to:"", from:"",subject:“Screen Capture From An Eggplant Test”, attachment:myCapture)

The following error appears in the Eggplant log:
2009-09-29 14:30:50.746 -0600 sendmail-Warning Unable to open file: /CaptureResult.tiff 34 on_captureresult CaptureResult.script

Any ideas from the crowd?

It may be thrown off by the “…/…/” in the path. I suggest using the actual path to the file. Here’s one way to get it:

put put the long name of file myCapture into myCaptureFullPath

Then use myCaptureFullPath in the SendMail command and see if that works better.

It worked for me. I encountered the same problem.

While running eggplant and adding values to a file it finds ResultFile = “~Documents\iPhone\Result.csv”

However when attaching the ResultFile to the email it didn’t work.

What worked is:
ResultFile = “/Users/Company/Documents/iPhone/Result.csv”


It might just be a typo in your post, but this is not a valid path:


You need a slash after the tilde:


If that wasn’t a transcription error, then it probably explains why the path didn’t work for you.