Sending E-mail from Eggplant

Is is possible to send e-mail from Eggplant? If so how?

The SendMail command is available via SenseTalk (see the Eggplant Reference).

One thing to look for is that the email client for the logged in user must be setup and configured for the mail to get properly routed. Basically, I simply used the email client to confirm the settings and then things worked fine.

SendMail works great if I specify all the parameters (host, type…) in a list.

However it does not work when I do not specify the SMTP params.

I have set the Mail options in the Eggplant preferences dialog. Any other reasons why it could be failing to do so?

Thanks in advance.

Mail server configurations have lots of options, so it’s difficult to say exactly what yours might be looking for that it isn’t getting. But one thing that we have seen cause problems in the past is the lack of a “from” header. You might try specifying that parameter and see if it makes a difference. Alternatively, you might try putting your full e-mail address in the username field of Eggplant’s e-mail preferences – your mail server may use that as the “from” field and only be willing to accept it if it is a valid e-mail address.

If that doesn’t work, let us know and if possible, tell us what error code your mail server returns.

Can you email a file attachment through Eggplant?

If so, how?

Thanks!

Yes, you just need to specify the Attachment property in the property list. Here’s an example from the Eggplant Reference (p. 154):

put ?LogFile? of last item of ScriptResults() into logfile 
sendmail( to: ?testmanager@mycompany.com, tester1@mycompany.com?, subject:?Test failed?, body: ?The very 
important test script generated an error. The log file is attached.?, attachment: logfile)

If you want to include multiple attachments, you can include a SenseTalk list as the value for the attachment keyword:

 sendmail( to: ?testmanager@mycompany.com, tester1@mycompany.com?, subject:?Hi?, body: ?See attached files.?, attachment: ("~/Documents/file1.txt", "~/Documents/file2.txt", "~/Documents/file3.txt"))

I’m not able to send attatchments via the sendmail.
I’m using
sendmail(smtp_host:“HOST”,smtp_type:“Login”,smtp_user:“USER”,smtp_password:“PASSWRD”,to:“to HER”,from:“from HIM”,subject:“I MISS U”,body:“BODY”,attatchment:“ATTATCH”)

It’ able to send mail,but could not attatch the file “ATTATCH”

Any pointers?

I think Attachments takes in a list.

You may want to try

attach: (“Attach1”, “Attach2”) etc.

Actually, it’s flexible – you can pass in a single file to attach, or a list of them. I suggest you double-check the spelling of the word “attachment”. Also, note that if the attachment file (or any of those in a list of attachments) can’t be found by Eggplant, it will log a warning. So you may want to check your results log and see if there is a warning listed there.

For reference, here’s a sendmail command that works for me:

sendmail (to:"myAddress@mycompany.com", from:"myAddress@mycompany.com", subject:"attachment test", body:"This is the body.", attachment:"foo.bar")

I really missed the proper name… :?
Thanks…it works beautifully