Η αποστολή email επιβεβαίωσης σε τελικό χρήστη είναι ένας τρόπος να επικοινωνήσετε αίσθηση εμπλοκής στους πελάτες σας. Είτε εγγράφονται σε newsletter είτε συμπληρώνουν ερωτηματολόγιο, ένα email επιβεβαίωσης επιτρέπει στον χρήστη να ξέρει ότι τα στοιχεία του έχουν ληφθεί υπόψη και θα επεξεργαστούν από τον ιδιοκτήτη της ιστοσελίδας.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title></title></head>
<body></body></html>
<body> tags:
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
</form>
<b>First Name:</b><br />
<input type="text" name="firstname" size="60" /><br /><br />
<b>Last Name:</b><br />
<input type="text" name="lastname" size="60" /><br /><br />
<b>Email Address:</b><br />
<input type="text" name="email" size="60" /><br /><br />
<input type="submit" value="Submit" name="submit" />
<?php ?>
if (isset($_POST['submit'])) { }
if (!empty($_POST['firstname'])) {
$firstname = $_POST['firstname'];
} else {
$firstname = FALSE;
echo "<p><font color='red'>Please enter your first name!</font></p>";
}
if (!empty($_POST['email'])) {
$email = $_POST['email'];
} else {
$email = FALSE;
echo "<p><font color='red'>Please enter your email address!</font></p>";
}
Σημείωση: Για email που πάνε σε βάση δεδομένων, συνιστάται χρήση regular expressions για ασφάλεια.
if ($firstname != FALSE && $lastname != FALSE && $email != FALSE) {
} else {
echo "<p><font color='red'><b>The email could not be sent due to an error. See above.</b></font></p>";
}
$to = $email;
$subject = "Thank you for becoming a member of 'yoursite.com'!";
$body = "<html><head></head><body>Thank you for joining 'yoursite.com'!<br /><br />We have the following details that you submitted:<br /><br /><b>First Name:</b> " . $firstname . "<br /><b>Last Name:</b> " . $lastname . "<br /><b>Email Address:</b> " . $email . "<br /><br />We welcome you to your team! Please contact us if this information is inaccurate.<br /><br />Thanks you, <br /><br /> Site Owner<br />email address</body></html>";
$headers = "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1\n" .
"From: Your Company[donotreply@yourdomain.com]\n" . "Cc: Your Name[youremail@yourdomain.com]\n";
mail($to, $subject, $body, $headers);
echo "<p><font color='navy'>Your information has been sent to the owner of the website! You should be receiving an email shortly!</font></p>";
Πνευματικά δικαιώματα © Γνώση Υπολογιστών Όλα τα δικαιώματα διατηρούνται.