I've got an old perl script that I'm updating, that using the SOAP interface to sugar.

Login, getting a session ID, searching using search_by_module and so forth all work. I'm hung up on inserting an email.

My theory of operations here is something like the following:
0) prepare all the needed data (to, from, contact ID's, HTML and plaintext parts of the email, etc)
1) Login
2) Get a session ID
3) Run a set_entry on the Emails module to create the email in Sugar.
4) run set_relationship to associate the email record with the contact

However, when I attempt to insert the email as a record in the Emails database, I am unable to get much of the data to show up in the record.

According to the results of get_module_fields run on the Emails module, I have the following to play with, which seems insufficient. I've set all these to valid dummy values, and can only set the text body, the various dates, and the created by and subject fields:
'id',
'date_entered',
'date_modified',
'assigned_user_id',
'modified_user_id',
'created_by',
'deleted',
'date_sent',
'message_id',
'name',
'type',
'status',
'flagged',
'reply_to_status',
'intent',
'mailbox_id',
'parent_type',
'parent_id',
'modified_by_name',
'created_by_name'


I guess that I'm wondering the following things: is my method the right way to do this? and secondly, am I missing some fields that I need to fill in?

Any help would be appreciated. I've been banging my head against this for weeks now.