Announcement

Collapse
No announcement yet.

Add Reply-To Header to MMX Contact Form

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Add Reply-To Header to MMX Contact Form

    What are the chances a Reply-To header can get added to the instance.mvt template for the mmx-contact-form flex component?

    I have been manually adding the following in red (which I need to do after any Miva update that includes flex component updates):

    Code:
    <mvt:comment>Set Email Helpers</mvt:comment>
    <mvt:assign name="l.settings:instance:submission:email:name" value="ternary( NOT ISNULL l.settings:instance:heading:heading_text:value, l.settings:instance:heading:heading_text:value, l.settings:sequence_item:name )" />
    <mvt:assign name="l.settings:instance:submission:email:subject " value="ternary( NOT ISNULL l.settings:instance:email:subject:value, l.settings:instance:email:subject:value, 'Form Submission for \"' $ l.settings:instance:submission:email:name $ '\" from \"' $ g.Store:name $ '\"')" />
    <mvt:assign name="g.eol" value="asciichar(13) $ asciichar(10)"/>
    <mvt:assign name="l.settings:instance:submission:email:headers " value="'MIME-Version: 1.0' $ g.eol" />
    <mvt:assign name="l.settings:instance:submission:email:headers " value="l.settings:instance:submission:email:headers $ 'Content-type: text/html; charset=' $ g.Store:charset $ g.eol" />
    <mvt:foreach iterator="field" array="instance:form:fields:children">
        <mvt:if expr="l.settings:field:type:value EQ 'input:email'">
            <mvt:assign name="l.settings:instance:submission:email:replyto " value="l.settings:field:submission:value" />
        </mvt:if>
    </mvt:foreach>
    <mvt:assign name="l.settings:instance:submission:email:headers " value="l.settings:instance:submission:email:headers $ 'Reply-To:' $ l.settings:instance:submission:email:replyto $ g.eol" />
    <mvt:assign name="l.settings:instance:submission:email:from" value="g.Store:email" />
    Can this be added to the instance.mvt for the mmx-contact-form flex component for the next Miva update so this does not have to be done manually?

    It makes replying to the contact form emails a bit easier and I believe the old contact form with the challenge question used similar code on the CTFM page template.

    Thank you.
    Last edited by SidFeyDesigns; 06-29-25, 07:40 AM.
    Nick Harkins
    www.loveisarose.com

    #2
    SidFeyDesigns Nick, email me - I created one with the help of Nick
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    Comment


      #3
      SidFeyDesigns This will be added in 10.13.00
      Nicholas Adkins
      Technical Training Specialist / Miva, Inc.
      [email protected]
      https://www.miva.com/mivalearn

      Comment


        #4
        Nick Awesome, can we also add a Display Name for the store email address for the "From" header? It could even be an optional field to fill out in the contact form component in page builder. The "Email" section where you can add the email Subject seems like a fitting place to put that.

        Thanks.
        Nick Harkins
        www.loveisarose.com

        Comment


          #5
          SidFeyDesigns 10.13.00 will also include a Reply-To header that can be set in the Flex Component settings.
          Nicholas Adkins
          Technical Training Specialist / Miva, Inc.
          [email protected]
          https://www.miva.com/mivalearn

          Comment


            #6
            Nick That's great! Thanks for that additional info. Am I correct to assume there will be an option to use the value of the email input field of the contact form?
            Nick Harkins
            www.loveisarose.com

            Comment


              #7
              SidFeyDesigns Correct if there is an email field within the form (if more than one then the first will be used), then the value for that field will be used as the Reply-To email address. Here is an example of the code that will be added to the component.

              Code:
              <mvt:comment>Email Reply-To</mvt:comment>
              <mvt:foreach iterator="field" array="instance:form:fields:children">
                  <mvt:if expr="l.settings:field:type:control EQ 'input' AND l.settings:field:type:control_type EQ 'email'">
                      <mvt:do name="g.Module_Library_Utilities" name="l.email_valid" value="Email_Validate( l.settings:field:submission:value )" />
                      <mvt:if expr="l.email_valid">
                          <mvt:assign name="l.settings:instance:submission:email:headers " value="l.settings:instance:submission:email:header s $ asciichar( 13 ) $ asciichar( 10 ) $ 'Reply-To: ' $ l.settings:field:submission:value" />
                          <mvt:foreachstop />
                      </mvt:if>
                  </mvt:if>
              </mvt:foreach>
              Nicholas Adkins
              Technical Training Specialist / Miva, Inc.
              [email protected]
              https://www.miva.com/mivalearn

              Comment


                #8
                Nick Beautiful, thank you for that. I'll update the code I've been using.
                Nick Harkins
                www.loveisarose.com

                Comment


                  #9
                  I just had to update this line:

                  Code:
                  <mvt:do file="g.Module_Library_Utilities" name="l.email_valid" value="Email_Validate( l.settings:field:submission:value )" />
                  and of course find the extra spaces in this line the forum likes to add to code snippets:

                  Code:
                  <mvt:assign name="l.settings:instance:submission:email:headers" value="l.settings:instance:submission:email:headers $ asciichar( 13 ) $ asciichar( 10 ) $ 'Reply-To: ' $ l.settings:field:submission:value" />
                  Otherwise it's working great. Thanks again Nick
                  Nick Harkins
                  www.loveisarose.com

                  Comment

                  Working...
                  X