I have downloaded Swift-mailer using composer, however when I go to test it I keep getting error messages.
This is what I have set up to set with:
<?php
require_once '/path/to/vendor/autoload.php';
// Create the Transport
$transport = (new Swift_SmtpTransport('smtp.justbitestreats.com', >25))
->setUsername('XXXXXX')
->setPassword('XXXXXX');
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
// Create a message
$message = (new Swift_Message('Wonderful Subject'))
->setFrom(['[email protected]' => 'Julie'])
->setTo(['[email protected]', '[email protected]' => 'JBT'])
->setBody('Here is the message itself');
// Send the message
$result = $mailer->send($message);
I have also tried using sendmail:
<?php
require_once '/path/to/vendor/autoload.php'(include_path='D:\xampp\php\PEAR');
// Create the Transport
$transport = new Swift_SendmailTransport('/usr/sbin/sendmail -bs');
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
// Create a message
$message = (new Swift_Message('Wonderful Subject'))
->setFrom(['[email protected]' => 'Julie'])
->setTo(['[email protected]' => 'A name'])
->setBody('Here is the message itself');
// Send the message
$result = $mailer->send($message);
I keep getting the same error messages
Here is the error message:
Warning: require_once(/path/to/vendor/autoload.php): failed to open stream: No such file or directory in D:\xampp\htdocs\dashboard\JBT-Emails\sendmail.php on line 2
Fatal error: require_once(): Failed opening required '/path/to/vendor/autoload.php' (include_path='D:\xampp\php\PEAR') in D:\xampp\htdocs\dashboard\JBT-Emails\sendmail.php on line 2