Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
- /* Exception class. */
- require 'phpmailer/src/Exception.php';
- /* The main PHPMailer class. */
- require 'phpmailer/src/PHPMailer.php';
- /* SMTP class, needed if you want to use SMTP. */
- require 'phpmailer/src/SMTP.php';
- $mail = new PHPMailer(true);
- /* ... */
- try {
- //Server settings
- $mail->SMTPDebug = 0; // Enable verbose debug output
- $mail->isSMTP(); // Send using SMTP
- $mail->Host = 'smtp.dpoczta.pl'; // Set the SMTP server to send through
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'szymon@ideasem.pl'; // SMTP username
- $mail->Password = 'Szymon.RDB123!@#'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` also accepted
- $mail->Port = 587; // TCP port to connect to
- $mail->CharSet = 'UTF-8';
- //Recipients
- $mail->setFrom('szymon@ideasem.pl', 'Formularz kontaktowy');
- $mail->addAddress('nk@rdbgroup.pl', 'Joe User'); // Add a recipient
- // Content
- $mail->isHTML(true);
- $mail->Subject = 'Szybka prośba o kontakt';
- $mail->Body = join('', array(
- "Nazwa firmy: ",
- $_POST['companyform'],
- "<br/>",
- "Imię i nazwisko: ",
- $_POST['nameform'],
- "<br/>",
- "Adres Email: ",
- $_POST['mailform'],
- "<br/>",
- "Numer telefonu: ",
- $_POST['phoneform'],
- "<br/>",
- "Wiadomość: ",
- $_POST['contentform'],
- ));
- $mail->send();
- echo "<script>alert('Wiadomość została wysłana')</script>";
- echo'<script>window.location.href="https://bpo2.you2.pl/mail-success.html";</script>';
- } catch (Exception $e) {
- echo "Wiadomość nie została wysłana. Powód: {$mail->ErrorInfo}";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement