PHP code example of trueapps / mailkomplet-swiftmailer
1. Go to this page and download the library: Download trueapps/mailkomplet-swiftmailer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
trueapps / mailkomplet-swiftmailer example snippets
//import the transport from the standard composer directory:
);
$mailer = new Swift_Mailer($transport);
//Instantiate the message you want to send.
$message = (new Swift_Message('Hello from MailKomplet!'))
->setFrom(['[email protected]' => 'John Doe'])
->setTo(['[email protected]'])
->setBody('<b>A really important message from our partners.</b>', 'text/html')
->addPart('Another important message from our partners.','text/plain');
//Add some attachment data:
$attachmentData = 'Some attachment data.';
$attachment = new Swift_Attachment($attachmentData, 'my-file.txt', 'application/octet-stream');
$message->attach($attachment);
//Send the message!
$mailer->send($message);
$transport = new \MailKomplet\Transport('<BASE_CRYPT>','<APIKEY>');
$transport->registerPlugin(new \MailKomplet\ThrowExceptionOnFailurePlugin());
$message = new Swift_Message('Hello from mailKomplet!');
$mailer->send($message); // Exception is throw when response !== 200
$defaultHeaders = ['X-MK-Tag' => 'my-tag'];
$transport = new \MailKomplet\Transport('<BASE_CRYPT>','<APIKEY>', $defaultHeaders);
$message = new Swift_Message('Hello from MailKomplet!');
// Overwriting default headers
$message->getHeaders()->addTextHeader('X-MK-Tag', 'custom-tag');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.