A new Form2Mail

by Andy Prevost

Sunday December 10 2023

Spoiler alert. Here's what the form setup to process with the Form2Mail class looks like:


if (count($_POST) > 0) {
  include_once('assets/mailer/class.Form2Mail.php');
  if ( class_exists('codeworxtech\Form2Mail')) {
    $f2m = new codeworxtech\Form2Mail();
    $f2m->useEnvRpt = true;
    $f2m->reserved_keys = 'hpot_okurl,hpot_url';
    $f2m->From(['noreply@yourdomain.com' => 'No Reply (unmonitored)']);
    $f2m->To(['toname@otherdomain.com' => 'Recipient Name']);
    //$f2m->Cc(['aname@adomain.com'=>'A Name','anothername@adomain.com'=>'Another Name']);
    //$f2m->Bcc(['anamebccadomain.com'=>'Abcc Name','anothernamebcc@adomain.com'=>'Anotherbcc Name']);
    $f2m->Subject('Form from server');
    //$f2m->plugin_presend = '';
    $f2m->plugin_autorespond = 'autoresponder_plugin.php';
    //$f2m->plugin_postsend = '';
    $f2m->redirectOnSuccess = 'form_thankyou.php';
    $f2m->SendForm();
  }
  exit();
}

Target release date: ?

The plug-in architecture is excellent. Available to the plug-in:

  • All of the valid $_POST variables via $this->posts
  • The environment variables via $this->message['env']
  • The text portion of the message via $this->message['text']
  • The HTMLportion of the message via $this->message['html']
  • All of the sender/recipients information via their respective class methods
  • ... and for the third plug-in (after sending emails), the disposition of the Send operation

Some exciting times ahead!

◀ Previous Next ▶

Post a Comment