Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!validar_nome($name) || !validar_email($email) || !validar_budget($budget) || !validar_mensagem($description) || !validar_cel($telefone || !validar_endereço($address))){
- header('Location: index.php');
- die();
- }
- try {
- $mail = new PHPMailer(true);
- //Server settings
- $mail->setLanguage("en");
- $mail->SMTPDebug = 0; #
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; //
- $mail->SMTPAuth = true;
- $mail->Username = '------';
- $mail->Password = '-----';
- $mail->SMTPSecure = 'ssl';
- $mail->Port = 465;
- //Recipients
- $mail->setFrom('-----', 'Ramdon Name');
- $mail->addAddress('------'); // Add a recipient
- //Content
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = "Contact " . $name;
- $mail->Body = "<b>E-mail</b>: " . $email . "." . "<br>" .
- "<b>Address: </b>" . $address . "." . "<br>" .
- "<b>City: </b>" . $city . "." . "<br>" .
- "<b>Telephone: </b>" . $telefone . "." . "<br>" .
- "<b>Budget: </b>" . $budget . "." . "<br>" .
- "<b>Services: </b>" . $services1 . "," .
- $services2 . "," .
- $services3 . "," .
- $services4 . "," .
- $services5 . "," .
- $services6 . "," .
- $services7 . "<br>" . "<br>" .
- "<b>Service description: </b>" . $description . ".";
- $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
- $mail->send();
- }
- catch (Exception $e) {
- echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement