I'm new to Python, so I'm having trouble figuring out how to get at a specific element in a Mail object. I'm creating the Mail object in a function and returning it:
data = getMessage()
When I do print (data)
it gives me the following:
{
'from': {
'email': 'my@email.com'
},
'subject': 'My Subject Line',
'personalizations': [{
'to': [{
'email': 'another@email.com'
}]
}],
'content': [{
'type': 'text/plain',
'value': 'http://localhost/some-url?t=ab99ceccf4ab4f97b1d014bb5e89707c'
}]
}
Now, I can do something like print (data.subject)
and it gives me My Subject Line
, but I can't figure out how to get to the value
property of content
. I just want to print the URL to the console for testing so I don't have to wait for the email to come through.
Now I'm just printing it from inside the function itself because that's the easy way, but I'd still like to know how to get it from the Mail object.