Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *************************************************
- *****Código de la configuración del email********
- *************************************************
- ```
- <?php
- if (isset($_POST['submitted'])) {
- include_once(ABSPATH . WPINC . '/class-phpmailer.php');
- $mail = new PHPMailer();
- $mail->IsSMTP();
- $mail->CharSet = 'UTF-8';
- $mail->Host = "smtp.gmail.com"; // SMTP server example
- $mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
- $mail->SMTPAuth = true; // enable SMTP authentication
- $mail->Port = 587; // set the SMTP port for the GMAIL server
- $mail->Username = "miemail@gmail.com"; // SMTP account username example
- $mail->Password = "mipassword"; // SMTP account password example
- $mail->SMTPSecure = "tls";
- $to = $nt_option['contact_email'];
- $subject = "Web Lluca Properties S.L";
- $message = $_POST['description'];
- $contactName = $_POST['contactName'];
- $fromemail = $_POST['email'];
- // $headers = 'MIME-Version: 1.0' . "\r\n";
- // $headers = "From: $fromemail\n";
- // $headers .= "Reply-to: $fromemail\n";
- // $headers .= "Content-Type: text/html; charset=iso-8859-1\n";
- $mail->From = $fromemail;
- $mail->FromName = $contactName;
- $mail->AddAddress($to);
- $mail->IsHTML(false);
- $mail->Subject = $subject;
- $mail->Body = $message;
- $result = $mail->Send();
- // if ($result) {
- // echo "El correo fue enviado correctamente.";
- // } else {
- // echo "Hubo un inconveniente. Contacta a un administrador.";
- // }
- if ($result) {
- $emailSent = true;
- }
- }
- ?>
- ```
- *************************************************
- ************Código del formulario****************
- *************************************************
- ```
- <form action="<?php the_permalink(); ?>" class="margin300" name="" method="post">
- <input type="hidden" name="submitted" id="submitted" value="true" />
- <div class="form-group col-lg-6 col-lg-6 col-sm-6 col-xs-12">
- <label><?php _e('Name', 'realto'); ?></label>
- <div class="input-group">
- <div class="input-group-addon"><i class="fa fa-user"></i></div>
- <input class="form-control" required name="contactName" id="contactName" value="<?php if (isset($_POST['contactName'])) echo $_POST['contactName']; ?>" placeholder="<?php _e("Please, insert your name", "realto"); ?>" type="text">
- </div>
- </div>
- <div class="form-group col-lg-6 col-lg-6 col-sm-6 col-xs-12">
- <label><?php _e('Email', 'realto'); ?></label>
- <div class="input-group">
- <div class="input-group-addon">@</div>
- <input class="form-control" name="email" required id="email" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" placeholder="<?php _e("Please, insert your email", "realto"); ?>" type="email">
- </div>
- </div>
- <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12">
- <label><?php _e('Message', 'realto'); ?></label>
- <textarea class="form-control" name="description" placeholder="<?php _e("Write your message", "realto"); ?>" rows="6"><?php if (isset($_POST['description'])) echo $_POST['description']; ?></textarea>
- </div>
- <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
- <input class="btn btn-realto span6" type="submit" name="submit" value="<?php _e("Submit", "realto"); ?>" />
- </div>
- </form>
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement