Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // function mailtrap($phpmailer) {
- // $phpmailer->isSMTP();
- // $phpmailer->Host = 'smtp.mailtrap.io';
- // $phpmailer->SMTPAuth = true;
- // $phpmailer->Port = 2525;
- // $phpmailer->Username = '99392d7b3447bc';
- // $phpmailer->Password = 'ba169f50aac147';
- // }
- // add_action('phpmailer_init', 'mailtrap');
- /*
- Enviando contato para a gestão de Leads do Eleve Crm
- */
- add_action('wpcf7_before_send_mail', 'wpcf7_to_web_service');
- function wpcf7_to_web_service ($WPCF7_ContactForm) {
- $submission = WPCF7_Submission::get_instance();
- $posted_data =& $submission->get_posted_data();
- if(!empty($posted_data))
- {
- if (isset($posted_data['form_anuncie']) && $posted_data['form_anuncie'] == 1)
- {
- $api_url = ELEVE_API_URL;
- $data_contato['nome_lead'] = $posted_data['nome'];
- $data_contato['email_lead'] = $posted_data['email'];
- $data_contato['telefone_lead'] = $posted_data['telefone'];
- $data_contato['token_conta'] = '7ddd2a9ce10a709';
- $data_contato['origem_lead'] = 'anuncio-portal-contabil';
- $expectativa = array(
- 'campo' => 'Expectativa',
- 'campo_slug' => 'expectativa',
- 'valor' => $posted_data['expectativa']
- );
- $empresa = array(
- 'campo' => 'Empresa',
- 'campo_slug' => 'empresa',
- 'valor' => $posted_data['empresa']
- );
- $data_contato['custom'] = array($expectativa, $empresa);
- $args = array(
- 'body' => $data_contato,
- 'timeout' => '5',
- 'redirection' => '5',
- 'httpversion' => '1.0',
- 'blocking' => true,
- 'headers' => array('Content-Type: application/json'),
- 'cookies' => array()
- );
- $response = wp_remote_post( $api_url, $args );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement