Tagged: autoresponder, contact, CONTACT FORM
-
AuthorPosts
-
March 3, 2026 at 1:30 pm #1495693
Hallo Support-Team,
ich möchte die automatische Kopie der Formulardaten in der Bestätigungs-E-Mail an den Absender deaktivieren.
Ich habe bereits folgenden Filter in der functions.php meines Child-Themes ausprobiert:
PHP add_filter('avf_form_autoresponder_copy', 'remove_form_copy_from_autoresponder', 10, 1); function remove_form_copy_from_autoresponder($copy) { return false; }Leider werden die Formulardaten weiterhin unterhalb meines benutzerdefinierten Bestätigungstextes in der E-Mail an den Absender mitgesendet. Ich verwende den Standard Avia Layout Architekten für das Kontaktformular.
Die E-Mail an den Administrator soll weiterhin alle Daten enthalten. Gibt es eine aktuellere Methode oder einen anderen Hook, um den Anhang der Formulardaten im Autoresponder zu unterdrücken?
Vielen Dank für eure Hilfe!
March 4, 2026 at 6:15 am #1495715Hey tebitron,
Thank you for the inquiry.
You can use this filter in the functions.php file to strip down the form data from the autoresponder message.
add_filter( 'avf_contact_form_autoresponder_mail', function( $mail_array, $new_post, $form_params, $form_obj ) { if( isset( $mail_array['Message'] ) ) { $marker = '<strong>' . __( 'Your Message:', 'avia_framework' ) . '</strong>'; $pos = strpos( $mail_array['Message'], $marker ); if( $pos !== false ) { $mail_array['Message'] = rtrim( substr( $mail_array['Message'], 0, $pos ) ); } } return $mail_array; }, 10, 4 );Best regards,
IsmaelMarch 4, 2026 at 12:48 pm #1495731Unfortunately, that didn’t do the job. What am I missing?
The autoresponder message still appears the same way.
-
This reply was modified 1 month ago by
tebitrongmbh.
March 5, 2026 at 6:25 am #1495755Hi,
Thank you for the update.
In the avf_contact_form_autoresponder_mail filter, you have to translate “Your Message:” text to German.
add_filter( 'avf_contact_form_autoresponder_mail', function( $mail_array, $new_post, $form_params, $form_obj ) { if( isset( $mail_array['Message'] ) ) { $marker = '<strong>' . __( 'Ihre Nachricht:', 'avia_framework' ) . '</strong>'; $pos = strpos( $mail_array['Message'], $marker ); if( $pos !== false ) { $mail_array['Message'] = rtrim( substr( $mail_array['Message'], 0, $pos ) ); } } return $mail_array; }, 10, 4 );Let us know how it goes.
Best regards,
IsmaelMarch 5, 2026 at 9:32 am #1495765Hi Ismael,
nope. Not yet. Still looks the same.
Kind regards.
-
This reply was modified 1 month ago by
tebitrongmbh.
March 6, 2026 at 6:45 am #1495806Hi,
Thank you for the update.
Is the following text actually included in the email?
###### Everything below this line shouldn’t appear ######Try to use this filter instead.
add_filter( 'avf_contact_form_autoresponder_mail', function( $mail_array, $new_post, $form_params, $form_obj ) { if ( ! isset( $mail_array['Message'] ) ) { return $mail_array; } $message = $mail_array['Message']; $separators = [ '<hr', '———' ]; foreach ( $separators as $sep ) { $pos = strpos( $message, $sep ); if ( $pos !== false ) { $mail_array['Message'] = rtrim( substr( $message, 0, $pos ) ); return $mail_array; } } $pattern = '/<br\s*\/?>\s*(?:Ihre Nachricht:|Anrede|Vorname|Nachname|E-Mail|Thema|Nachricht)\s*:?/i'; if ( preg_match( $pattern, $message, $matches, PREG_OFFSET_CAPTURE ) ) { $mail_array['Message'] = rtrim( substr( $message, 0, $matches[0][1] ) ); } return $mail_array; }, 10, 4 );Best regards,
IsmaelMarch 6, 2026 at 9:11 am #1495812Hi Isamel,
awesome – it looks much better. Thanks.
And yes, that part is not supposed to be in the email either – that was just for your information.
The only remainder I’d love to remove is “Ihre Nachricht:” – that’s still coming through.
Kind regards.
March 7, 2026 at 2:51 pm #1495837Hi,
Try this instead:add_filter( 'avf_contact_form_autoresponder_mail', function( $mail_array, $new_post, $form_params, $form_obj ) { if ( ! isset( $mail_array['Message'] ) ) { return $mail_array; } $message = $mail_array['Message']; $separators = [ '<hr', '———' ]; foreach ( $separators as $sep ) { $pos = strpos( $message, $sep ); if ( $pos !== false ) { $mail_array['Message'] = rtrim( substr( $message, 0, $pos ) ); return $mail_array; } } $pattern = '/<br\s*\/?>\s*(?:Ihre Nachricht|Anrede|Vorname|Nachname|E-Mail|Thema|Nachricht)\s*:?/i'; if ( preg_match( $pattern, $message, $matches, PREG_OFFSET_CAPTURE ) ) { $mail_array['Message'] = rtrim( substr( $message, 0, $matches[0][1] ) ); } return $mail_array; }, 10, 4 );Or this:
add_filter( 'avf_contact_form_autoresponder_mail', function( $mail_array, $new_post, $form_params, $form_obj ) { if ( ! isset( $mail_array['Message'] ) ) { return $mail_array; } $message = $mail_array['Message']; $separators = [ '<hr', '———' ]; foreach ( $separators as $sep ) { $pos = strpos( $message, $sep ); if ( $pos !== false ) { $mail_array['Message'] = rtrim( substr( $message, 0, $pos ) ); return $mail_array; } } $pattern = '/(?:<br\s*\/?>)?\s*Ihre Nachricht\s*:?|<br\s*\/?>\s*(?:Anrede|Vorname|Nachname|E-Mail|Thema|Nachricht)\s*:?/i'; if ( preg_match( $pattern, $message, $matches, PREG_OFFSET_CAPTURE ) ) { $mail_array['Message'] = rtrim( substr( $message, 0, $matches[0][1] ) ); } return $mail_array; }, 10, 4 );Best regards,
MikeMarch 19, 2026 at 12:18 pm #1496165Thanks a lot Mike. That worked well.
Best regards.
-
This reply was modified 1 month ago by
-
AuthorPosts
- You must be logged in to reply to this topic.
