Send Mail Setup not being added o the API

Version 3.6.1
Mac OS

The sendmail step code does not get added to the Server Connect API.

Here is my Server Connect Action … (Makes no difference if I include the setup step or not)

Here is he code …

<?php
require('../../../dmxConnectLib/dmxConnect.php');


$app = new \lib\App();

$app->define(<<<'JSON'
{
  "meta": {
    "options": {
      "linkedFile": "/contact.php",
      "linkedForm": "formContactUs"
    },
    "$_POST": [
      {
        "type": "text",
        "fieldName": "inputUserName",
        "options": {
          "rules": {
            "core:required": {
              "param": ""
            }
          }
        },
        "name": "inputUserName"
      },
      {
        "type": "text",
        "fieldName": "inputUserPhone",
        "name": "inputUserPhone"
      },
      {
        "type": "text",
        "fieldName": "inputUserEmail",
        "options": {
          "rules": {
            "core:required": {
              "param": ""
            }
          }
        },
        "name": "inputUserEmail"
      },
      {
        "type": "text",
        "fieldName": "textareaUserMessage",
        "options": {
          "rules": {
            "core:required": {
              "param": ""
            }
          }
        },
        "name": "textareaUserMessage"
      }
    ]
  },
  "exec": {
    "steps": [
      {
        "name": "recaptcha",
        "module": "recaptcha",
        "action": "validate",
        "options": {
          "secret": "6LdSE08UAAAAAHMNLFMVaMtrveH10ZlW9NQzWTyy"
        }
      },
      {
        "name": "insertContact",
        "module": "dbupdater",
        "action": "insert",
        "options": {
          "connection": "Remote",
          "sql": {
            "type": "insert",
            "values": [
              {
                "table": "formContacts",
                "column": "contactName",
                "type": "text",
                "value": "{{$_POST.inputUserName}}"
              },
              {
                "table": "formContacts",
                "column": "contactEmail",
                "type": "text",
                "value": "{{$_POST.inputUserEmail}}"
              },
              {
                "table": "formContacts",
                "column": "contactPhone",
                "type": "text",
                "value": "{{$_POST.inputUserPhone}}"
              },
              {
                "table": "formContacts",
                "column": "contactMessage",
                "type": "text",
                "value": "{{$_POST.textareaUserMessage}}"
              },
              {
                "table": "formContacts",
                "column": "contactDate",
                "type": "datetime",
                "value": "{{NOW.formatDate('yyyy-MM-dd')}}"
              }
            ],
            "table": "formContacts",
            "returning": "contactId",
            "query": "INSERT INTO formContacts\n(contactName, contactEmail, contactPhone, contactMessage, contactDate) VALUES (:P1 /* {{$_POST.inputUserName}} */, :P2 /* {{$_POST.inputUserEmail}} */, :P3 /* {{$_POST.inputUserPhone}} */, :P4 /* {{$_POST.textareaUserMessage}} */, :P5 /* {{NOW.formatDate('yyyy-MM-dd')}} */)",
            "params": [
              {
                "name": ":P1",
                "type": "expression",
                "value": "{{$_POST.inputUserName}}"
              },
              {
                "name": ":P2",
                "type": "expression",
                "value": "{{$_POST.inputUserEmail}}"
              },
              {
                "name": ":P3",
                "type": "expression",
                "value": "{{$_POST.inputUserPhone}}"
              },
              {
                "name": ":P4",
                "type": "expression",
                "value": "{{$_POST.textareaUserMessage}}"
              },
              {
                "name": ":P5",
                "type": "expression",
                "value": "{{NOW.formatDate('yyyy-MM-dd')}}"
              }
            ]
          }
        },
        "meta": [
          {
            "name": "identity",
            "type": "text"
          },
          {
            "name": "affected",
            "type": "number"
          }
        ]
      },
      "Mailer/mailer",
      {
        "name": "",
        "module": "mail",
        "action": "send",
        "options": {
          "instance": "mailer",
          "subject": "WLST Contact Form",
          "fromName": "{{$_POST.inputUserName}}",
          "fromEmail": "{{$_POST.inputUserEmail}}",
          "replyTo": "{{$_POST.inputUserEmail}}",
          "toName": "Williams Lake Studio Theatre",
          "toEmail": "boxoffice@wlstudiotheatre.ca",
          "contentType": "html",
          "body": "<p>Test</p>"
        }
      }
    ]
  }
}
JSON
);
?>

I think the problem was that I called my mail set up ‘mailer’? Is that a conflict?

I changed my mail set up name to ‘sendContact’ and now it works fine.

Maybe you can add the mail setup as global? That is the new way.

Yes, that was how I did it. Seems naming it ‘mailer’ causes an error. Renamed the mail set up in globals to ‘sendContact’ and it works.

1 Like

Well if you add it as globals then there is no need to add it again as a local step. Just the send mail

I know that, I added it just for testing. :wink: