Author Topic: How to send email from JavaScript code, in a plugin  (Read 6506 times)

Offline himari_usagi

  • Newbie
  • *
  • Posts: 1
How to send email from JavaScript code, in a plugin
« on: January 13, 2023, 06:25:58 AM »
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

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,850
Re: How to send email from JavaScript code, in a plugin
« Reply #1 on: January 14, 2023, 03:32:28 AM »
call the action like this
Code: [Select]
rcmail.command('send','')
or call the send function directly like this:
Code: [Select]
rcmail.submit_messageform()
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦