Use HTML content type – not working with custom shortcode
-
Hi Support team,
Use HTML content type ( Already checked )-> This is not working and i can see Table in email. as I am adding my code using my custom shortcode.
-
Where can we see the website in question?
Hi
its custom plugin in which i am working. I have some custom Data which i want to send in Email. as all data set using Table.
And yeah sorry i was forgot to say that i have used plugin : Contact Form 7 Dynamic Text Extension
So is there any way to do using filter and no need to use above plugin. Please advice.
Thanks
Okay so i have disabled that third party plugin and now doing with CF7 Filters.
here is my code.
add_filter('wpcf7_mail_components','my_custom_mail', 10,2); function my_custom_mail($mail_component, $contact_form){ $domain_data = do_shortcode( '[g4whostingdata]' ); if($wpcf7->id() == 6){ $mail_component['subject']; //email subject $mail_component['sender']; //sender field (from) $mail_component['body']; //email body $mail_component['recipient']; //email recipient (to) $mail_component['additional_headers']; //email headers, cc:, bcc:, reply-to: $mail_component['attachments']; //file attachments if any $key_values = array(); $tags = $contact_form->scan_form_tags(); //get your form tags foreach($tags as $tag){ $field_name = $tag['name']; if(isset($_POST[$field_name]) && !empty($_POST[$field_name])){ //get all the submitted fields form your form $key_values[$field_name] = $_POST[$field_name]; } } $body = "Dear \n" . "First Name: {$key_values['first-name']} \n" . "Last name: {$key_values['last-name']} \n" . "Email: {$key_values['your-email']} \n" . "Domain Data : {$domain_data} \n"; $mail_component['body'] = $body; } return $mail_component; }I have set FORM ID but its showing Internal server errors and form is not submitted. could you please advice.
Thanks
Okay so look like i have fixed. This will helps to others.
// define the wpcf7_mail_components callback
function filter_wpcf7_mail_components( $components, $number ) { $contact_form = WPCF7_ContactForm::get_current(); $contact_form_id = $contact_form -> id; if($contact_form_id == 6){ $components[ 'subject' ] = 'New Domain request from customer'; $components[ 'body' ] = $components['body']; $components[ 'body' ] .= do_shortcode( '[g4whostingdata]' ); return $components; } }; // add the filter add_filter( 'wpcf7_mail_components', 'filter_wpcf7_mail_components', 10, 2 );But my question is why HTML tags are not supported even i have selected from settings. I have Table structure in Short code but its showing table tags in email.
Please advice.
Thanks
Hi @takayukister,
did you checked my last comment.I have said this:
But my question is why HTML tags are not supported even i have selected from settings. I have Table structure in Short code but its showing table tags in email.
Please advice.
Don’t know why you made this thread as resolved !
Thanks
The topic ‘Use HTML content type – not working with custom shortcode’ is closed to new replies.