Formatted text for email

I’d like to explore creating an email for a condition or many conditions depending what the email is going to relay. I’d like to create a formatted text with multiple lines with spacing. I learn by example and wonder if anyone can share something they started?

Thanks in advance

Has anyone emailed from Eggplant?

If you’re looking for a response from the community, then it’s appropriate to post here. For support issues, please email Eggplant technical support directly…

I am able to email from Eggplant but asking the community if they have sent a multi line email and how they formatted it? Looking for ideas relay info to someone that needs to know the result or what is waiting to happen. We are trying to alert that something needs to happen(waiting for interfaces) to continue the next steps.

Hope that this following helps.
Dave

Script requires the following code to be place inside test script

RunWithNewResults ScriptName
put the result into TestResult

Sends an email from within a script and closes

If global ScriptOwner is empty then
put “sender@mailserver.domain.com” into global ScriptOwner
End If
set MailHost to “mailserver.domain.com"
set MailAuthentication to “Login"
set MailUser to “eggplantadmin@eggplantmanager.domain.com"
set MailPassword to “password"
set MailType to “text/html"
put global TestResult.Duration div 60 into TestDurationInMinutes
put global TestResult.Duration rem 60 into TestDurationInSeconds
put format (”%02i”,TestDurationInSeconds) into TestDurationInSeconds
put TestDurationInMinutes&”:”&TestDurationInSeconds into TestDuration
put global TestResult.LogFile into ScreenError
replace “logfile.txt” with “screen_error.png” in ScreenError
put “” into MailBody
put “" after MailBody
put “" after MailBody
put “" after MailBody
put “" after MailBody
put “" after MailBody
put “" after MailBody
put “" after MailBody
set Recipient to global ScriptOwner
set Title to "Parameterized email test"
If global TestResult’s Status is “success” then
set Title to “SUCCESS - Test:”&&global TestName
sendMail (To:Recipient,<br> Subject:Title,<br> SMTP_HOST:MailHost,<br> SMTP_TYPE:MailAuthentication,<br> SMTP_USER:MailUser,<br> SMTP_PASSWORD:MailPassword,<br> “Content-Type”:MailType,<br> Body: MailBody,<br> Attachment: global TestResult.LogFile)
Else
set Title to “FAILURE - Test”&&global TestName
sendMail (To:Recipient,<br> Subject:Title,<br> SMTP_HOST:MailHost,<br> SMTP_TYPE:MailAuthentication,<br> SMTP_USER:MailUser,<br> SMTP_PASSWORD:MailPassword,<br> “Content-Type”:MailType,<br> Body: MailBody,<br> Attachment: (ScreenError,global TestResult.LogFile))
End If

Duration: ”&&TestDuration&&”
Errors: ”&&global TestResult.Errors&&"
Exceptions: ”&&global TestResult.Exceptions&&"
Log File Location: ”&&global TestResult.LogFile&&"
Run Date/Time: ”&&global TestResult.RunDate&&"
Status: ”&&global TestResult.Status&&"
Warnings: ”&&global TestResult.Warnings&&"

Thanks Dave, yes this is very helpful. I've been playing with how to get permission to send emails automatically inside out network. For obvious reasons.

Thanks,

Scott

P.S. - Sorry I didn't see your response until now. I don't know how I missed it.


I can not see Dave’s code above, can someone share again? TIA

Not sure what’s going on with the code tagging. Removed it so that you can read the post.

Hi Leann,

Just let me know if you have any questions around my SendMail script, and I can follow up with you directly.

Thanks,
Dave