Neuron-PHP

helpers.php

Table of Contents

Functions

sendEmail()  : bool
Send a simple email
sendEmailTemplate()  : bool
Send an email using a template
email()  : Sender
Create a new email Sender instance with fluent interface

Functions

sendEmail()

Send a simple email

sendEmail(string $to, string $subject, string $body[, bool $isHtml = true ][, ISettingSource|null $settings = null ]) : bool
Parameters
$to : string

Recipient email address

$subject : string

Email subject

$body : string

Email body content

$isHtml : bool = true

Whether the body is HTML (default: true)

$settings : ISettingSource|null = null

Optional settings source for email configuration

Tags
example

sendEmail('[email protected]', 'Welcome!', '

Welcome to our site!

');

Return values
bool

True if email was sent successfully

sendEmailTemplate()

Send an email using a template

sendEmailTemplate(string $to, string $subject, string $template[, array<string|int, mixed> $data = [] ][, ISettingSource|null $settings = null ][, string $basePath = '' ]) : bool
Parameters
$to : string

Recipient email address

$subject : string

Email subject

$template : string

Template path relative to resources/views

$data : array<string|int, mixed> = []

Data to pass to the template

$settings : ISettingSource|null = null

Optional settings source for email configuration

$basePath : string = ''

Base path for template resolution (default: current directory)

Tags
example

sendEmailTemplate( '[email protected]', 'Welcome!', 'emails/welcome', ['userName' => 'John', 'activationLink' => 'https://...'] );

Return values
bool

True if email was sent successfully

email()

Create a new email Sender instance with fluent interface

email([ISettingSource|null $settings = null ][, string $basePath = '' ]) : Sender
Parameters
$settings : ISettingSource|null = null

Optional settings source for email configuration

$basePath : string = ''

Base path for template resolution (default: current directory)

Tags
example

email() ->to('[email protected]') ->cc('[email protected]') ->subject('Order Confirmation') ->template('emails/order-confirmation', ['order' => $order]) ->attach('/path/to/invoice.pdf', 'invoice.pdf') ->send();

Return values
Sender

        
On this page

Search results