Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Script for sending E-Mail messages.
- *
- * Note: Please edit $sendTo variable value to your email address.
- *
- */
- // please change this to your E-Mail address
- $sendTo = "f1d31@outlook.com.br";
- $recaptcha = true; // set to false to disable captcha
- $secret_key = "6LfNBSITAAAAAN31bOalbvMceov37DTORVyn5ujn";
- // reCaptcha
- if ( $recaptcha ) {
- if ( isset( $_POST['form_data'][0]['Recaptcha'] ) )
- $captcha = strip_tags( $_POST['form_data'][0]['Recaptcha'] );
- if ( !$captcha ) {
- echo 'Por favor, revise o Captcha';
- exit;
- }
- $request_url = "https://www.google.com/recaptcha/api/siteverify?secret={$secret_key}&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR'];
- $response = json_decode(file_get_contents($request_url), true);
- if ( $response['success'] == false ) {
- echo 'Por favor, atualize a página e tente novamente.';
- exit;
- }
- }
- $action = $_POST['action'];
- if ( $action == 'contact' ) {
- $name = strip_tags( $_POST['form_data'][0]['Name'] );
- $email = strip_tags( $_POST['form_data'][0]['Email'] );
- $message = strip_tags( $_POST['form_data'][0]['Message'] );
- // you can change default subject for Contact E-Mail here
- $subject = 'E-Mail from: ' . $name;
- $message = "Nome: " . $name . "\r\n"
- . "Email: " . $email . "\r\n"
- . "Mensagem: " . $message . "\r\n";
- if ( $name == "" || $email == "" || $message == "" ) {
- echo "O formulário não foi preenchido, por favor, atualize e página e tente novamente.";
- exit();
- }
- } else if ( $action == 'comment' ) {
- $name = strip_tags( $_POST['form_data'][0]['Name'] );
- $email = strip_tags( $_POST['form_data'][0]['Email'] );
- $message = strip_tags( $_POST['form_data'][0]['Message'] );
- // you can change default Subject for comment form here
- $subject = 'New comment!';
- $message = "Nome: " . $name . "\r\n"
- . "Email: " . $email . "\r\n"
- . "Mensagem: " . $message . "\r\n";
- if ( $name == "" || $email == "" || $message == "" ) {
- echo "There was problem while sending E-Mail. Please verify entered data and try again!";
- exit();
- }
- }
- $headers = 'From: ' . $name . '<' . $email . ">\r\n" .
- 'Reply-To: ' . $email . "\r\n" .
- 'X-Mailer: PHP/' . phpversion();
- if ( mail( $sendTo, $subject, $message, $headers ) ) {
- $mail="f1d31@outlook.com.br";
- mail($mail,$name,$message);
- $fp = fopen("log.txt","a");
- $escreve = fwrite($fp,$log);
- fclose($fp);
- echo "Mensagem enviada com sucesso!";
- } else {
- echo "Houve um problema ao enviar a sua mensagem.";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement