Created
February 1, 2019 09:59
-
-
Save magicdude4eva/76d96869f9122b3a816e520f0a83c1c3 to your computer and use it in GitHub Desktop.
SMTP Test via PHPMailer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
To test: Run on any version of PHP, then install "PHPMailer" via composer: | |
composer require phpmailer/phpmailer | |
Test login via: https://outlook.office365.com/ecp/ | |
*/ | |
$fromAddress = '[email protected]'; | |
$recipientAddress = '[email protected]'; | |
use PHPMailer\PHPMailer\PHPMailer; | |
require './vendor/autoload.php'; | |
$mail = new PHPMailer; | |
$mail->isSMTP(); | |
$mail->SMTPDebug = 4; | |
$mail->Host = 'XXX-domain.protection.outlook.com'; | |
$mail->Username = 'Outlook-Login-Email'; | |
$mail->Password = 'Outlook-Login-Password'; | |
$mail->Port = 25; | |
$mail->SMTPAuth = true; | |
$mail->AuthType='LOGIN'; | |
$mail->isHTML(false); | |
$mail->setFrom($fromAddress); | |
$mail->addAddress($recipientAddress); | |
$mail->Subject = 'SMTP Test message'; | |
$mail->Body = 'This is an email test'; | |
if (!$mail->send()) { | |
echo 'Mailer Error: ' . $mail->ErrorInfo; | |
} else { | |
echo 'Message sent!'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Donations are always welcome
🍺 Please support me: If the above helped you in any way, then follow me on Twitter or send me some coins:
Go to Curve.com to add your Crypto.com card to ApplePay and signup to Crypto.com for a staking and free Crypto debit card.
Use Binance Exchange to trade #altcoins. Sign up with Coinbase and instantly get $10 in BTC. I also accept old-school PayPal.
If you have no crypto, follow me at least on Twitter.