Exemple #1
0
    <?php 
$sendingEmail = (bool) $_POST['email'];
$sentEmail = false;
if ($sendingEmail) {
    require_once 'emailer.php';
    $emailer = new Emailer();
    $emailer->toEmail('*****@*****.**')->fromEmail($_POST['email'])->subject("uv-pc.com message from '" . $_POST['email'] . "'")->message($_POST['message']);
    $sentEmail = $emailer->send();
    if ($sentEmail) {
        ?>
        <div class="alert alert-success">You message has been sent.  Thank you.</div>
        <?php 
        // Send CC to the sender
        $emailer->toEmail($_POST['email'])->message("This is a copy of a message you sent to uv-pc.com - for your records.\n\n" . $_POST['message'])->send();
    } else {
        $errorOut = "<ul><li>" . implode($emailer->getErrors(), "</li><li>") . "</li></ul>";
        ?>
        <div class="alert alert-danger">
          We encountered a problem sending your message:<br>
          <?php 
        echo $errorOut;
        ?>
        </div>
        <?php 
    }
}
if (!sendingEmail || !$sentEmail) {
    ?>
    <form action="./" method="POST">
      <input type="text" name="email" placeholder="Email Address" value="<?php 
    echo $_POST['email'];