email.send(options)
options.relatedRecords – Object that contains key-value pairs to associate (attach) the Message record with related records (that is, transaction, activity, entity, and custom records).
Represents the NetSuite records to which an email Message record should be attached. You can associate the sent email with the following records listed below. You cannot use custom record, transaction, and activity together as an email related record; these three records are mutually exclusive.
Only entityId is compatible with other records

var senderId = -5;
var recipientEmail = 'notify@myCompany.com';
var timeStamp = new Date().getUTCMilliseconds();
var recipientId = 12;
var fileObj = file.load({
id: 88
});
email.send({
author: senderId,
recipients: recipientId,
subject: 'Test Sample Email Module',
body: 'email body',
attachments: [fileObj],
relatedRecords: {
entityId: recipientId,
customRecord:{
id:recordId,
recordType: recordTypeId //an integer value
}
}
});