Neos9 - Neos.Fusion.Form:Runtime testing incomming Mails

I have a Problem in my ContactForm.fusion, as in demo, see

prototype(Custom.Site:Content.ContactForm) < prototype(Neos.Neos:ContentComponent) {

  title = ${q(node).property('title')}


  // prototype(Neos.Fusion.Form:Form) {

  //   renderer = afx`

  //     <form {...attributes}>

  //       <div class="contact-wrapper">

  //         <div class="contact-box">

  //           {content}

  //           {footer}

  //         </div>

  //       </div>

  //     </form>

  //   `

  // }




  // prototype(Neos.Fusion.Form:FieldContainer) {

  //   renderer = afx`

  //     <div class="mb-3">

  //       <label class="form-label">

  //         {props.label}

  //       </label>

  //       {props.content}

  //       <div class="text-danger">

  //         {props.error}

  //       </div>

  //     </div>

  //   `

  // }




  // prototype(Neos.Fusion.Form:Input) {

  //   attributes.class = 'form-control'

  // }




  // prototype(Neos.Fusion.Form:Textarea) {

  //   attributes.class = 'form-control'

  // }




  renderer = Neos.Fusion.Form:Runtime.RuntimeForm {

    attributes {

      id = ${'form-' + node.aggregateId}

      action = ${'#' + this.id}

    }




    # namespace for all form values and the initial data, so called argument namespace.

    namespace = 'contact'




    # initial form to prefill the fields

    data = Neos.Fusion:DataStructure {

      name = 'Jim'

      email = 'jim@hotmail.com'

      message = 'I want to train!'

    }




    # the form process for rendering, collecting data and validation

    process {

      content = afx`

        <h2 class="text-center mb-2">

          <Neos.Neos:Editable property="title" />

        </h2>




        <Neos.Fusion.Form:FieldContainer label="Name<span class='required-star'>*</span>" field.name="name">

          <Neos.Fusion.Form:Input attributes.required={true} />

        </Neos.Fusion.Form:FieldContainer>




        <Neos.Fusion.Form:FieldContainer label="Email<span class='required-star'>*</span>" field.name="email">

          <Neos.Fusion.Form:Input attributes.type="email" attributes.required={true} />

        </Neos.Fusion.Form:FieldContainer>

        

        <Neos.Fusion.Form:FieldContainer label="Message<span class='required-star'>*</span>" field.name="message">

          <Neos.Fusion.Form:Textarea attributes.required={true} />

        </Neos.Fusion.Form:FieldContainer>

      `




      footer = afx`

        <div class="text-center">

          <button type="submit" class="btn btn-success w-100">Send</button>

        </div>

      `




      schema {

        name = ${Form.Schema.string().isRequired()}

        email = ${Form.Schema.string().isRequired().validator('EmailAddress')}

        message = ${Form.Schema.string().isRequired()}

      }

    }




    # action after process is finished

    action {

      message {

        type = 'Neos.Fusion.Form.Runtime:Message'

        options.message = ${q(node).property('message')}

      }




      email {

        @if.has = ${q(node).property('subject') && q(node).property('recipientAddress') && q(node).property('senderAddress')}

        type = 'Neos.Fusion.Form.Runtime:Email'

        options {

          recipientName = ${q(node).property('recipientName')}

          recipientAddress = ${q(node).property('recipientAddress')}

          senderName = ${q(node).property('senderName')}

          senderAddress = ${q(node).property('senderAddress')}

          replyToAddress = ${data.email}

          subject = ${q(node).property('subject')}

          html = afx`

            <p>Message from {data.name}</p>

            <p>{data.message}</p>

          `

        }

      }




      redirect {

        @if.has = ${q(node).property('redirect')}

        type = 'Neos.Fusion.Form.Runtime:Redirect'

        options.uri = Neos.Neos:NodeUri {

          node = ${q(node).property('redirect')}

        }

      }




      log {

        type = 'Neos.Fusion.Form.Runtime:Log'

        options {

          logger = 'systemLogger'

          level = 'info'

          message = 'Contact Form was submitted'

          context = ${data}

        }

      }




    }




  }




}

And my Settings.DB.yaml

  SwiftMailer:

    transport:

      type: 'Swift_SmtpTransport'

      options:

        host: '127.0.0.1'

        port: 1025

I installed MailHog, so MailHog working with host and port from CLI (Mails comming to http://localhost:8025/) But when I submit form > I see Good luck! > logged data in System_Development.log, but no Mail in MailHog comming. I asking what could be the issue? Or how should I test it?

My Configuration was false, MailHog uses SymfonyMailer not SwiftMailer

Please check what version of neos/form is installed. If it is 6.x then you should install neos/symfonymailer and configure the DSN to target Mailhog GitHub - neos/symfonymailer: A Flow package for easy use of the Symfony Mailer · GitHub

1 Like