Hello Dr. Trigon,
this means, the hint given:
For your problem: try calling Site.getToken(getagain=True) when you get the exception, and retry. (this calls self._load(force=True) and throug
finally works!
The last point is now to figure out why site.getToken sometimes is called properly and sometimes not...???
Intuitively, I think this is what happens: sometimes when requesting a token, the connection is reset (or something equivalent) - this is why it only happens every now and then. This is then interpreted by the framework as 'hey, we cannot get the data right now, so let's assume something more-or-less sensible'.
By calling Site.getToken(getagain=True), you force the framework to retry getting that data, which succeeds after which you can send the e-mail.
Best, Merlijn