Ciao Mark, I made it from IBM Cloud, activated Email Delivery service from there (https://cloud.ibm.com/catalog/infrastructure/email-delivery), and validated my email in Sendgrid.
Moreover, you need to change a couple of things in the code you pasted:
- define reporthtml, in fact it is meant to be a html text, try with the following at the beginning : reporthtml = "Hello, <br>This is a test email"
- <<<sendgrid API KEY >>>> is meant to be the APIKEY you need to generate in Sendgrid: go to Sendgrid site, from the menu select "Settings", then "API Keys", and then click on the button "Create API Key"
------------------------------
Massimo Loaldi
Advisory Partner Technical Specialist - Automation
IBM
Segrate (MI)
------------------------------
Original Message:
Sent: Fri November 10, 2023 11:57 AM
From: Mark Hickok
Subject: Watson Studio and IBM Cloud Email Delivery
Were you running this in WOK/IKC notebook on-premises???
I tried your jode in a notebokk and am getting this error. Did you not get this?:

------------------------------
Mark Hickok
Original Message:
Sent: Wed November 08, 2023 03:57 AM
From: Massimo Loaldi
Subject: Watson Studio and IBM Cloud Email Delivery
I found the answer! Actually yesterday I missed validating my email in SendGrid, hence no email was correctly sent..
The code in python within Watson Studio notebook for sending is the following :
------------------------------
Massimo Loaldi
Original Message:
Sent: Tue November 07, 2023 07:17 AM
From: Massimo Loaldi
Subject: Watson Studio and IBM Cloud Email Delivery
I need to create a notebook and connect to IBM Cloud Email Delivery for sending emails.
I activated the IBM Cloud Email Delivery service and generated the API Key, yet unable to write down the code to create the linkage and send out emails.
Any hints on how to proceed ?
Thanks in advance
#Watsonstudio
------------------------------
Massimo Loaldi
------------------------------