1. Go to this page and download the library: Download hoa/mail 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/ */
hoa / mail example snippets
Hoa\Mail\Message::setDefaultTransport(
new Hoa\Mail\Transport\Smtp(
new Hoa\Socket\Client('tcp://mail.domain.tld:587'),
'gordon_freeman',
'*********'
)
);
$message = new Hoa\Mail\Message();
$message['From'] = 'Gordon Freeman <[email protected]>';
$message['To'] = 'Alyx Vance <[email protected]>';
$message['Subject'] = 'Hoa is awesome!';
$message->addContent(
new Hoa\Mail\Content\Text('Check this out: http://hoa-project.net/!')
);
$message->send();
$message->addContent(
// We have either…
new Hoa\Mail\Content\Alternative([
// … a text content
new Hoa\Mail\Content\Text(
'Check this out: http://hoa-project.net/!'
),
// … or an HTML content.
new Hoa\Mail\Content\Html(
'<a href="http://hoa-project.net/">Check this ' .
'<strong>out</strong>!</a>'
)
])
);
$message->addContent(
new Hoa\Mail\Content\Attachment(
new Hoa\File\Read('Attachment.jpg'),
'Foobar.jpg'
)
);
$message->send();
// The image.
$attachment = new Hoa\Mail\Content\Attachment(
new Hoa\File\Read('Attachment.jpg'),
'Foobar.jpg'
);
// The text content.
$text = new Hoa\Mail\Content\Text('Check this out: http://hoa-project.net/!');
// The HTML content.
$html = new Hoa\Mail\Content\Html(
'<img src="' .
// The HTML image URL is the attachment ID URL.
$attachment->getIdUrl() .
'" />'
);
$message->addContent(
// Alternative contents and attachment are related.
new Hoa\Mail\Content\Related([
// We still have 2 alternative contents: text or HTML.
new Hoa\Mail\Content\Alternative([$text, $html]),
$attachment
])
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.