Load classes earlier
This commit is contained in:
parent
9a85f499b2
commit
3dffb3e4ee
|
|
@ -7,6 +7,8 @@
|
||||||
//Import the PHPMailer class into the global namespace
|
//Import the PHPMailer class into the global namespace
|
||||||
use PHPMailer\PHPMailer\PHPMailer;
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
|
||||||
|
require '../vendor/autoload.php';
|
||||||
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if (array_key_exists('userfile', $_FILES)) {
|
if (array_key_exists('userfile', $_FILES)) {
|
||||||
// First handle the upload
|
// First handle the upload
|
||||||
|
|
@ -20,7 +22,6 @@ if (array_key_exists('userfile', $_FILES)) {
|
||||||
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
|
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
|
||||||
// Upload handled successfully
|
// Upload handled successfully
|
||||||
// Now create a message
|
// Now create a message
|
||||||
require '../vendor/autoload.php';
|
|
||||||
$mail = new PHPMailer();
|
$mail = new PHPMailer();
|
||||||
$mail->setFrom('from@example.com', 'First Last');
|
$mail->setFrom('from@example.com', 'First Last');
|
||||||
$mail->addAddress('whoto@example.com', 'John Doe');
|
$mail->addAddress('whoto@example.com', 'John Doe');
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,10 @@
|
||||||
//Import the PHPMailer class into the global namespace
|
//Import the PHPMailer class into the global namespace
|
||||||
use PHPMailer\PHPMailer\PHPMailer;
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
|
||||||
|
require '../vendor/autoload.php';
|
||||||
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if (array_key_exists('userfile', $_FILES)) {
|
if (array_key_exists('userfile', $_FILES)) {
|
||||||
require '../vendor/autoload.php';
|
|
||||||
// Create a message
|
// Create a message
|
||||||
$mail = new PHPMailer();
|
$mail = new PHPMailer();
|
||||||
$mail->setFrom('from@example.com', 'First Last');
|
$mail->setFrom('from@example.com', 'First Last');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue