forked from NumairAhmed1/reimagined-enigma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcareersdata.php
34 lines (30 loc) · 1.13 KB
/
careersdata.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
<?php
// Enable error reporting
ini_set('display_errors', 1);
error_reporting(E_ALL);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'];
$email = $_POST['email']; // Sender's email, could be used in "From" header
$position = $_POST['position'];
$cover_letter = $_POST['cover_letter'];
// Assuming $resume is processed and stored temporarily
// Handling file uploads and sending as attachments requires more complex handling,
// typically using a library like PHPMailer.
// Email recipient
$to = '[email protected]'; // Corrected email address
// Subject of the email
$subject = 'Application for ' . $position;
// Construct email body
$message = "Name: $name\nEmail: $email\nPosition: $position\nCover Letter:\n$cover_letter";
// Headers
$headers = "From: $email" . "\r\n" .
"Reply-To: $email" . "\r\n" .
"X-Mailer: PHP/" . phpversion();
// Attempt to send the email
if(mail($to, $subject, $message, $headers)) {
echo "Application submitted successfully!";
} else {
echo "Failed to send the application.";
}
}
?>