File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,12 +137,18 @@ These actions are only run for the target form by ID or slug.
137137``` php
138138add_action( 'wplf_post_validate_submission', 'my_email_thankyou' );
139139function my_email_thankyou( $return ) {
140+ // recipient details from submission
140141 $name = sanitize_text_field( $_POST['name'] );
141142 $email = sanitize_email( $_POST['email'] );
142- $to = "\"$name\" <$email>";
143+
144+ // email subject
143145 $subject = __( 'Thank You For Submitting A Form' );
144- $content = wp_sprintf( __('Thanks, %s for clicking Submit on this glorious HTML5 Form!'), $name );
145- wp_mail( $to, $subject, $content );
146+
147+ // text body of email
148+ $body = wp_sprintf( __('Thanks, %s for clicking Submit on this glorious HTML5 Form!'), $name );
149+
150+ // send the email
151+ wp_mail( $email, $subject, $body );
146152}
147153```
148154
You can’t perform that action at this time.
0 commit comments