Realised that when you set both 'th' and 'rm' keys in the _extraParams dictionary parameter for sendMessage(), the new message will be threaded correctly into the thread/msg id specified.

It sets up the corresponding In-Reply-To and References headers quite nicely.

However, although the message is sent and threaded, the gmail server returns a "HTTP Error 500: Internal Server Error".

Other than simply ignoring the error since the message still gets sent and threaded correctly, is there any method to prevent it?