Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- date_default_timezone_set('America/Los_Angeles');
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\SMTP;
- use PHPMailer\PHPMailer\Exception;
- include_once("src/PHPMailer.php");
- include_once("src/SMTP.php");
- include_once("src/Exception.php");
- $mail = new PHPMailer;
- $mail->SMTPDebug = 1;
- $mail->Port = 587;
- $mail->IsSMTP();
- $mail->Host = 'mail.mymail.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'admin@mymail.com';
- $mail->Password = 'Pa55word';
- $mail->SMTPSecure = ''; // tried ssl and tls, with same result
- $mail->ClearAddresses();
- $mail->AddAddress('testmail@gmail.com', 'tester1');
- $mail->From = "admin@mymail.com";
- $mail->FromName = "Username";
- $mail->Subject = 'Hi there';
- $mail->Body = "This is a test message";
- if ($mail->Send()) {
- echo "Message sent!\n";
- }
- else {
- echo "Message failed!\n";
- print_r($mail->ErrorInfo);
- }
- exit();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement