0) { $name = ''; $email = ''; $phone = ''; $company = ''; $designation = ''; $billing_name = ''; $billing_email = ''; $billing_phone = ''; $billing_company = ''; $address_line1 = ''; $address_line2 = ''; $city = ''; $state = ''; $country = ''; $pincode = ''; $isValid = true; if (empty($_POST['form_name']) or empty($_POST['form_email']) or empty($_POST['form_phone']) or empty($_POST['form_company']) or empty($_POST['billing_name']) or empty($_POST['billing_email']) or empty($_POST['billing_phone']) or empty($_POST['billing_company'])) { $isValid = false; } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } if ($isValid) { $name = test_input($_POST['form_name']); $email = test_input($_POST['form_email']); $phone = test_input($_POST['form_phone']); $company = test_input($_POST['form_company']); $designation = test_input($_POST['form_designation']); $billing_name = test_input($_POST['billing_name']); $billing_email = test_input($_POST['billing_email']); $billing_phone = test_input($_POST['billing_phone']); $billing_company = test_input($_POST['billing_company']); $address_line1 = test_input($_POST['address_line1']); $address_line2 = test_input($_POST['address_line2']); $city = test_input($_POST['city']); $state = test_input($_POST['state']); $country = test_input($_POST['country']); $pincode = test_input($_POST['pincode']); $mail = new PHPMailer; $mail->isSMTP(); // Set mailer to use SMTP $mail->SMTPOptions = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ], ]; $mail->Host = 'mail.lyotalk.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'web@lyotalk.com'; // SMTP username $mail->Password = 'lyotalk@123'; // SMTP password $mail->SMTPSecure = ''; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; $mail->setFrom('web@lyotalk.com', 'Lyotalk Ireland 2017'); $mail->addAddress('web@biotrains.com.test-google-a.com', 'Lyotalk Ireland 2017'); // Add a recipient //var_dump($_FILES);die(); $mail->isHTML(true); $mail->Subject = "Registration of Lyotalk Ireland - 2017"; $body = 'Hi I am '.$name.' and have mailed for '.$mail->Subject.'.
Delegate Details : Name : '.$name.'
Email : '.$email.'
Phone : '.$phone.'
Company : '.$company.'
Designation : '.$designation.'
Billing Details : Billing Name : '.$billing_name.'
Billing Email : '.$billing_email.'
Billing Phone : '.$billing_phone.'
Billing Company : '.$billing_company.'
Address Line 1 : '.$address_line1.'
Address Line 2 : '.$address_line2.'
City : '.$city.'
State : '.$state.'
Country : '.$country. '
Pincode : '.$pincode; $mail->Body = nl2br($body); $msg = ["msg" => "Email sent successfully!"]; if (!$mail->send()) { $msg["msg"] = "Failed to send email - " . $mail->ErrorInfo; } header("Location: http://www.lyotalk.com/"); /* Redirect browser */ } else { echo json_encode(["msg" => "Some fields are missing!"]); } } else { echo json_encode(["msg" => "Somethings wrong!"]); } ?>