1. Go to this page and download the library: Download shoutboxnet/shoutbox 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/ */
shoutboxnet / shoutbox example snippets
// Your API key from Shoutbox.net
$apiKey = 'your-api-key-here';
// Prepare email data
$data = [
'from' => '[email protected]',
'to' => '[email protected]',
'subject' => 'Test Email',
'html' => '<h1>Hello!</h1><p>This is a test email.</p>',
'name' => 'Sender Name',
'reply_to' => '[email protected]'
];
// Make the API call
$ch = curl_init('https://api.shoutbox.net/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
// Handle the response
if ($httpCode >= 200 && $httpCode < 300) {
echo "Email sent successfully!\n";
} else {
echo "Failed to send email. Status code: $httpCode\n";
}
houtbox\Client;
use Shoutbox\EmailOptions;
use Shoutbox\Attachment;
// Initialize client
$apiKey = getenv('SHOUTBOX_API_KEY') ?: 'your-api-key-here';
$client = new Client($apiKey);
try {
// Basic email
$options = new EmailOptions();
$options->from = '[email protected]';
$options->to = '[email protected]';
$options->subject = 'Test Email';
$options->html = '<h1>Hello!</h1><p>This is a test email.</p>';
$options->name = 'Sender Name';
$options->replyTo = '[email protected]';
$client->sendEmail($options);
// Email with attachment
$attachment = new Attachment();
$attachment->filepath = './document.pdf';
$attachment->filename = 'document.pdf';
$attachment->contentType = 'application/pdf';
$optionsWithAttachment = new EmailOptions();
$optionsWithAttachment->from = '[email protected]';
$optionsWithAttachment->to = '[email protected]';
$optionsWithAttachment->subject = 'Test Email with Attachment';
$optionsWithAttachment->html = '<h1>Hello!</h1><p>This email
class SendEmailJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Mail::to('[email protected]')
->send(new ShoutboxMail('<h1>Hello</h1><p>This is a queued email.</p>'));
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.