Roundcube Community Forum

 

How to send email from JavaScript code, in a plugin

Started by himari_usagi, January 13, 2023, 06:25:58 AM

Previous topic - Next topic

himari_usagi

Hi,

I have a plugin that must add a disclaimer to a composed email, just before sending.
The email-altering code must use JavaScript, and so is triggered by a 'beforesend' event handler.

The disclaimer is obtained via an async HTTP call, which means:
1. the 'beforesend' handler must return false, to prevent the immediate email send, and give time to the HTTP call to happen;
2. after the disclaimer is obtained and the composed email altered, an email "send" action must be triggered.

My question is how to trigger an email send using JavaScript.

Thanks

JohnDoh

call the action like this
rcmail.command('send','')

or call the send function directly like this:
rcmail.submit_messageform()
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...