Observe.Before seems to return scrambled information
When I run the following code from the Github page it fails, both URL, body, data and xhr don't have anything similar to the format I would expect.
gmail.observe.before("send_message", function(url, body, data, xhr) {
// lets cc this email to someone extra if the subject is 'Fake example'
console.log('xxxxxx')
if (data.subject == "Fake example") {
if (body_params.cc) {
if (typeof body_params.cc != "object")
body_params.cc = [body_params.cc];
} else {
body_params.cc = [];
}
body_params.cc.push("[email protected]");
}
// now change the subject
body_params.subject = "Subject overwritten!";
console.log(
"sending message, url:",
url,
"body",
body,
"email_data",
data,
"xhr",
xhr
);
});
It’s a known error since new Gmail.
The only workaround I can think of is hijacking/intercepting the click event of the send button in the compose DOM.
@mrappard @josteink The before send_messageevent is still showing scrambled body_params. What is a good way that you have tried for intercepting and changing the body before the email is sent?
I only ever extract the full EML message upon send.
I never alter the message itself. With "new" Gmail, I don't think that's supported anymore, due to how Google changed the whole mail-sending process.
Old issue is old. Closing.