1. Go to this page and download the library: Download oliver-schoendorn/mailer 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/ */
use OS\Mail\MailAttachment;
$inlineImage = (new MailAttachment('file.jpg'))
->setContent(fopen('path/to/file.jpg', 'r'))
->setMimeType('image/jpg');
$mail->addInlineAttachment($inlineImage);
use Zend\Mime\Mime;
use OS\Mail\MailBody;
$mail->addBodyPart((new MailBody())
->setMimeType(Mime::TYPE_TEXT)
->setContent('Plain text mail content'));
$mail->addBodyPart((new MailBody())
->setMimeType(Mime::TYPE_HTML)
->setContent('<html><body><p>Html mail content<img src="' . $inlineImage . '" /></p></body></html>'));
use OS\Mail\MailAttachment;
$mail->addAttachment((new MailAttachment('file.jpg'))
->setContent(fopen('path/to/file.jpg', 'r'))
->setMimeType('image/jpg'));
use OS\Mail\MailTransportFactory;
$mailTransport = (new MailTransportFactory())->createSmtpTransportWithLogin(
$config['mail']['user'],
$config['mail']['pass'],
$config['mail']['encryption'],
$config['mail']['name'],
$config['mail']['host'],
$config['mail']['port']
);
$mail->send($mailTransport);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.