<?php
add_action('wpcf7_before_send_mail','action__wpcf7_before_send_mail', 20, 3);
function action__wpcf7_before_send_mail($contact_form, $abort, $wpcf7_submission)
{
$submission = WPCF7_Submission::get_instance(); // CF7 Submission Instance
$form_instance = WPCF7_ContactForm::get_instance($form_ID); // CF7 From Instance
$form_ID = $contact_form->id();
$form_title = $contact_form->title();
if ($submission) {
// All Posted Data
$posted_data = $submission->get_posted_data();
}
// Get Conatct form Properties
$properties = $contact_form->get_properties();
/* For Mail One
*
* $properties['mail']
* We can replace all the value of mail tags
* $properties['mail'][active] = 1 if the mail is enable
*
*/
$properties['mail']['recipient'] = 'kahnuc.swain@nettantra.net';
$properties['mail']['subject'] = 'Your New Subject';
$properties['mail']['sender'] = 'From Name <allodiasongs.com@gmail.com>';
$properties['mail']['body'] = '<h1>Hello this is body</h1>';
$properties['mail']['additional_headers'] = 'Reply-To: kahnuc.swain@nettantra.net
Cc: kanhak.khatua@nettantra.net Bcc: djkanha044@gmail.com';
$properties['mail']['attachments'] = '';
$properties['mail']['use_html'] = 1; // Use HTML inside your body
$properties['mail']['exclude_blank'] = 1; // Remove the blank space
/* For Mail Two - Auto Responder
*
* $properties['mail']
* We can replace all the value of mail tags
* $properties['mail_2'][active] = 1 if the mail is enable
*
*/
$properties['mail_2']['recipient'] = 'kahnuc.swain@nettantra.net';
$properties['mail_2']['subject'] = 'Your New Subject';
$properties['mail_2']['sender'] = 'From Name <allodiasongs.com@gmail.com>';
$properties['mail_2']['body'] = '<h1>Hello this is body</h1>';
$properties['mail_2']['additional_headers'] = 'Reply-To: kahnuc.swain@nettantra.net
Cc: kanhak.khatua@nettantra.net Bcc: djkanha044@gmail.com';
$properties['mail_2']['attachments'] = '';
$properties['mail_2']['use_html'] = 1;
$properties['mail_2']['exclude_blank'] = 1;
/*
* Set email properties to contatc form 7
*/
$contact_form->set_properties($properties);
//Last return
return $submission;
}
0 Comments
Post a Comment