Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update body before send_message #802

Open
fmealla opened this issue Nov 26, 2024 · 1 comment
Open

update body before send_message #802

fmealla opened this issue Nov 26, 2024 · 1 comment

Comments

@fmealla
Copy link

fmealla commented Nov 26, 2024

Hi!!
I am trying to add a text to the body right before the send_message is executed. I am making the changes using the before send_message listener, but I don't see the change being reflected. Is there any way to do this?

@josteink
Copy link
Collaborator

josteink commented Dec 6, 2024

I don't think that's going to work (anymore). AFAIK 2 things have changed on Gmail's end:

  • scheduled/delayed send
  • how sending email (once sending is commenced) is actually implemented

First of all, I believe the send_message is only triggered once the actual email is being sent, not when the user clicks "send", and the default is that email sending is delayed slightly to allow a user to cancel sending, if they quickly discover something was wrong or the email was sent accidentally.

This will cause a disconnect in time between when the email-editor view is open and the sending of the actual email (and thus the triggering of the event) happens. This may be causing confusion on your end?

Secondly, the event-data has changed. In the olde days, gmail would send the entire mail as you clicked send, and we could (as I understand) intercept and modify the contents before the email was sent off.

Now the email contents is constantly passed off to the gmail-servers as the user authors it, and when you click "Send" gmail just instructs the server to send the message which is already uploaded.

This means that to modify the message "on send", you must:

  1. intercept the click-event for the "send" button.
  2. physically alter the message in the editor.
  3. trigger a user-like event for the editor to make Gmail upload it to the server.
  4. invoke the intercepted send-button event-handler
  5. hope it works.

Not undoable... But nothing I have tried or even prototyped.

And it's clearly outside the scope of what Gmail.js plans to deliver of features.

If you want to do this, you're on your own... But feel free to share with the community how you did it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants