isSMTP(); $mail->Host = $smtpHost; $mail->SMTPAuth = true; $mail->Username = $smtpUser; $mail->Password = $smtpPass; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; /* Email headers */ $mail->setFrom($smtpUser, 'Wedding RSVP'); $mail->addAddress($to); $mail->Subject = $subject; $mail->Body = $body; $mail->send(); echo "Thank you! Your RSVP has been sent."; } catch (Exception $e) { error_log("RSVP mail failed: " . $mail->ErrorInfo); exit("Sorry, something went wrong sending your RSVP."); } ?>