-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit-career.php
39 lines (29 loc) · 1.28 KB
/
submit-career.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
try {
// SMTP configuration
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'foramdelvadiya@gmail.com'; // Your email
$mail->Password = 'nhtg hqft xsps isqj'; // Your password or App Password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS
$mail->Port = 587; // TCP port to connect to
// Recipients
$mail->setFrom('foramdelvadiya@gmail.com', $_REQUEST['fname']);
$mail->addAddress('recipient@example.com');
// Email content
$mail->isHTML(true);
$mail->Subject = 'Career Details';
$html = 'First Name : '. $_REQUEST['fname'].'<br>'. 'Last Name :'.$_REQUEST['lname'].'<br>'.'Email : '.$_REQUEST['email'].'<br>'.'Phone Number : '.$_REQUEST['phone'];
$mail->Body = $html;
// Send the email
$mail->send();
echo json_encode(value: ["message" => "Your Details has been submitted successfully."]);
} catch (Exception $e) {
echo json_encode(value: ["message" => "Your Details has been not submitted. EMailerrror: {$mail->ErrorInfo}"]);
}
?>