D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
vitalityhealth
/
public_html
/
aa
/
invite
/
Filename :
send.php
back
Copy
<?php include 'cn.php'; // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); // require 'phpmailer\src\Exception.php'; // require 'phpmailer\src\PHPMailer.php'; // require 'phpmailer\src\SMTP.php'; // use PHPMailer\PHPMailer\PHPMailer; // use PHPMailer\PHPMailer\Exception; $user_id = $_POST["id"]; $name = $_POST["name"]; $email = $_POST["email"]; $contact_no = $_POST["contact"]; $sql = "INSERT INTO `mails`(`user_id`, `name`, `email`, `contact_no`) VALUES ('".$user_id."','".$name."','".$email."','".$contact_no."') "; $result = $con->query($sql); $from = 'no-reply@mether.info'; $to = $_POST["email"]; $ccEmail = 'ansul241@gmail.com'; $subject = 'Your Invitation Image'; // $mail = new PHPMailer(true); // $mail->isSMTP(); // $mail->Host = 'smtp.gmail.com'; // $mail->SMTPAuth = true; // $mail->Username = '399sandeepsahu@gmail.com'; // $mail->Password = 'kxdq ucxw zybp tcin'; // $mail->SMTPSecure = 'ssl'; // $mail->Port = 465; // $mail->setFrom('399sandeepsahu@gmail.com'); // $mail->addAddress($_POST["email"]); // // Add CC recipient (Carbon Copy) // $ccEmail = '399sandeepsahu@gmail.com'; // $mail->addCC($ccEmail); // $mail->isHTML(true); // $mail->Subject = "Your Invitation Image"; // Define the boundary for the email $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // print_r($_POST);exit; // Headers for attachment $headers = "MIME-Version: 1.0\r\n"; $headers .= "From: Mether.info<no-reply@mether.info>\r\n"; $headers .= "Cc: $ccEmail\r\n"; $headers .= "Content-Type: multipart/related; boundary=\"{$mime_boundary}\"\r\n"; $message = "--{$mime_boundary}\r\n"; $message .= "Content-Type: text/html; charset=\"UTF-8\"\r\n"; $message .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $message = '<html><head><title>Download Your Invitation Image</title></head><body>'; $message = 'Hello ' . $_POST["name"] . ',<br><br>'; $message .= 'Please find your custom invitation attached to this email.<br><br>'; $message = 'Contact Number: ' . $_POST["contact"] . ',<br><br>'; $message .= '<img src="' . $_POST["image_url"] . '" alt="Your Image"><br><br>'; $message .= 'Download Link: <a href="' . $_POST["image_url"] . '" download>Download Your Invitation Image</a>'; $message .= '</body></html>'; // $mail->Body = $message; try { $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= "From: Mether.info<no-reply@mether.info>" . "\r\n"; $headers .= "Cc: $ccEmail" . "\r\n"; // $mail->send(); // ob_end_flush(); // flush(); // echo "Hello"; if(mail($to, $subject, $message, $headers)){ $imageUrl = $_POST["image_url"]; // $filename = uniqid() . '.png'; // header('Content-Disposition: attachment; filename="' . $filename . '"'); // header('Content-Type: image/png'); // readfile($imageUrl); // echo 'This is success'; echo "<script> window.location.href = 'thank-you.php'; </script>"; }else{ echo 'Something went wrong please try again'; } } catch (Exception $e) { echo "Email could not be sent. Mailer Error: " . $mail->ErrorInfo; } ?>