i have created the custom module in which i want run cron Scheduled. please can any one help that is may code on submission:
public function submitForm(array &$ form, FormStateInterface $ form_state) { $ to = 'a***@gmail.com'; $ params['subject'] = t('Drupal SMTP test e-mail'); $ params['body'] = array(t('If you receive this message it means your site is capable of using SMTP to send e-mail.')); $ account = \Drupal::currentUser(); \Drupal::service('plugin.manager.mail')->mail('simple_mail', 'simple_mail', $ to, $ account->getPreferredLangcode(), $ params); drupal_set_message(t('A test e-mail has been sent to @email via SMTP. You may want to check the log for any error messages.', ['@email' => $ to])); return $ form; }
i want add cron settings in it to schedule my mails.