1. Go to this page and download the library: Download uccello/email-history 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/ */
uccello / email-history example snippets
use Illuminate\Database\Migrations\Migration;
use Uccello\Core\Models\Module;
use Uccello\Core\Models\Relatedlist;
class CreateEmailHistoryRl extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$module = Module::where('name', 'account')->first(); // Change 'account' with the source module's name
$relatedModule = Module::where('name', 'email')->first();
Relatedlist::create([
'module_id' => $module->id,
'related_module_id' => $relatedModule->id,
'related_field_id' => $relatedModule->fields->where('name', 'entity')->first()->id,
'tab_id' => null,
'label' => 'relatedlist.emails',
'type' => 'n-1',
'method' => 'getDependentList',
'sequence' => $module->relatedlists()->count(),
'data' => null
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$module = Module::where('name', 'account')->first(); // Change 'account' with the source module's name
$relatedModule = Module::where('name', 'email')->first();
Relatedlist::where('module_id', $module->id)
->where('related_module_id', $relatedModule->id)
->where('label', 'relatedlist.emails')
->delete();
}
}
use Uccello\EmailHistory\Facades\EmailHistory;
// Use function params
EmailHistory::add(
$domain, // Current domain
$record->uuid, // Record uuid
'Hi everyone!', // Email subject
'A beautiful email to remember install this package', // Email body
'[email protected]', // To
Carbon::now(), // Sent at - optional
[ // An array with all attachments (File name => File path in storage) - optional
"File1.pdf" => "uccello/files/zPODV1l0WF4wEJsad7xHsX6G7D7Cu004AEKjDSkd.pdf",
"File2.pdf" => "uccello/files/zPODV1l0WF4wEJsad7xHsX6G7D7Cu004AEKjDSkd.pdf"
],
'[email protected]', // Cc - optional
'[email protected]' // Bcc - optional
);
// Use array
EmailHistory::addWithArray([
'subject' => $subject,
'body' => $body,
'sent_at' => $sentAt, // Optional
'to' => $to,
'cc' => $cc, // Optional
'bcc' => $bcc, // Optional
'attachment' => $attachment, // Optional
'domain_id' => $domain->id,
'entity' => $entity_uuid
])