Configuring a Mail Server in Eggplant Functional
Eggplant Functional (EPF) can send emails as notifications of test results. Email notifications let interested parties quickly learn the outcomes of test executions and react as needed. Eggplant Functional uses the SendMail command to send emails, so these email notifications are controlled at the script level.
Configuring SMTP Settings
You must have an account with an SMTP server provided by your organization or by a third party, such as Gmail. It is often helpful to consult the administrator of the SMTP server to get a good idea of which settings are relevant to your specific SMTP server. Some trial and error, experimenting with different combinations of settings, is required when the SMTP server details are unknown.
Eggplant does not provide you with an SMTP server.
Eggplant Functional takes the SMTP server properties you provide and attempts to send an email using those settings, and displays errors if it is unable to send an email using those properties. Eggplant Functional errors in Windows are generic and indicate that Eggplant Functional is unable to send an email with the provided SMTP properties. In Mac OS, view the generic error in the Console for additional information about the nature of the error.
It is possible to specify SMTP mail server properties at either the script or application level.
When using SendMail in an Eggplant Functional script that is run via command line, such as through Eggplant Manager, Jenkins, HP ALM, etc., it is generally necessary to provide all of the required mail server properties inline with the SendMail command. This is because the instance of Eggplant Functional is usually running as a user that does not have access to application-level preferences. Script-level configuration is achieved by including the smtp_host, smtp_type, smtp_user, smtp_password, and smtp_port properties and their associated values as part of the SendMail command.
To quickly test whether your application-level SMTP properties are correct, write a simple SendMail command that includes the necessary properties for your SMTP mail server, and execute the command in Eggplant Functional. If Eggplant Functional reports that the email was sent, and you receive the test email, your configuration is correct.
Example:
sendMail (To:"tester@testing.com", from:"tester@testing.com", smtp_host:"<smtp mail server IP or hostname>",smtp_type:"login", smtp_user:"tester", smtp_password:"123456", smtp_port:"465" ,Subject:"test email")
If you plan to consistently use the same SMTP server for all emails sent from Eggplant Functional and will only run the scripts through the Eggplant Functional GUI, you can configure SMTP server information at the application level to simplify your code.
To configure SMTP server settings for the entire Eggplant Functional Preferences, go to Eggplant > Preferences > Accounts. Provide an SMTP Server ID
, Transport type
, Port number
, and Authentication type
. Most, but not all, SMTP servers require a User Name and Password, so provide these details when applicable.
Example:
sendMail (To:"test@gmail.com", Subject:"Test email worked!")
Below is an example of correct configuration for Gmail within Eggplant Functional preferences.