• Resolved chladog

    (@chladog)


    Hello,

    Thank you for awesome plugin!

    I’m using this plugin for contact forms, everything is working like a charm. I’m missing only one thing.
    When I setup Notifications it would be awesome to be able to set “Reply-To” email header, as “From” address is usually different than address I want to send email when I click “Reply” later in email client.

    Would you consider to add this feature?

    Keep up the great work!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author fabianlindfors

    (@fabianlindfors)

    Hello and thanks for your kind words!

    You make a good point and although you’re the only one who has requested this feature I see how it could be useful to many.

    I’m trying to keep the admin interface as simple and uncluttered as possible so I’m going to have to think a while about adding it. Until then it’s really easy to achieve using a single filter. You can find the documentation here: https://advancedforms.github.io/filters/emails/af-form-email-headers/

    Hope this helps!

    Thread Starter chladog

    (@chladog)

    Thank you for your consideration and temp. solution. I hope you manage to squeeze it there, maybe when conditional checkbox is met.

    The filter works fine, but must be coded for the project. Cannot set source field as easy as clicking “Insert field” button and choosing from current form-available fields (for example “Your E-mail” form field).

    I would love this functionality as well. A few minutes ago a client brought up wanting to be able to just click “reply-all” in an email to reply to the customer inquiring about something without having to copy and paste. I was like hmm, looked around the plugin settings but didn’t see any options.

    I’m going to give that filter solution a try, though. Glad I checked the forums.

    Great plugin regardless!

    Me again. So the filter worked with me adding my own reply-to and custom emails. But I’m stumped now. How would I go about adding the user’s supplied email {field:email} to the filter_email_headers() code? It’s probably really simple and I’m overthinking it.

    Thanks!

    Thread Starter chladog

    (@chladog)

    Get the value with ‘af_get_field()’:

    function filter_email_headers( $headers, $email, $form, $fields ) {
    	$reply = af_get_field( 'email' );
    	$headers[] = 'Reply-To: '.$reply;
    
        return $headers;
    }
    add_filter( 'af/form/email/headers', 'filter_email_headers', 10, 4 );

    Great that worked, @chladog! Now, I have another thing. So I have two notifications setup: one is a “Thank you for your submission. We’ll contact shortly” email that goes to the user. And one that emails to the managers when the form is submitted.

    When I did the filter of the headers, it gets applied to both notifications. Attempting to do a conditional, like if the recipient is “custom” then apply the filter to headers. (I don’t want the reply-to to apply to the user.) Does that make sense what I’m trying to achieve? I looked into the _af_render_field_include() but also wasn’t making sense how to get it to work.

    Any help would be grand

    Thread Starter chladog

    (@chladog)

    I think this should work ??

    function filter_email_headers( $headers, $email, $form, $fields ) {
    	$reply = af_get_field( 'email' );
    	if ($email['recipient_type'] == 'custom')
    		$headers[] = 'Reply-To: '.$reply;
      return $headers;
    }
    add_filter( 'af/form/email/headers', 'filter_email_headers', 10, 4 );

    That worked perfectly! Thanks @chladog.

    Just adding myself to the list of users who are interested in an UI to solve this.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘‘Reply-To’ Field in Notifications’ is closed to new replies.