mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Email doc formatting
Workaround markdown parser throwing a fit with code straight after list.
This commit is contained in:
parent
bf67679155
commit
100ad658db
@ -39,6 +39,8 @@ The default HTML template is located in `framework/templates/email/GenericEmail.
|
|||||||
* Choose your template with **setTemplate()**
|
* Choose your template with **setTemplate()**
|
||||||
* Populate any custom data into the template before sending with **populateTemplate()**
|
* Populate any custom data into the template before sending with **populateTemplate()**
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
$email = new Email($from, $to, $subject, $body);
|
$email = new Email($from, $to, $subject, $body);
|
||||||
$email->setTemplate('MyEmail');
|
$email->setTemplate('MyEmail');
|
||||||
@ -47,6 +49,7 @@ The default HTML template is located in `framework/templates/email/GenericEmail.
|
|||||||
$email->populateTemplate(Member::currentUser());
|
$email->populateTemplate(Member::currentUser());
|
||||||
|
|
||||||
$welcomeMsg = 'Thank you for joining on '.date('Y-m-d'.'!');
|
$welcomeMsg = 'Thank you for joining on '.date('Y-m-d'.'!');
|
||||||
|
|
||||||
$email->populateTemplate(array(
|
$email->populateTemplate(array(
|
||||||
'WelcomeMessage' => $welcomeMsg, // Accessible in template via $WelcomeMessage
|
'WelcomeMessage' => $welcomeMsg, // Accessible in template via $WelcomeMessage
|
||||||
));
|
));
|
||||||
@ -54,7 +57,6 @@ The default HTML template is located in `framework/templates/email/GenericEmail.
|
|||||||
$email->send();
|
$email->send();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Subclassing
|
### Subclassing
|
||||||
|
|
||||||
Class definition:
|
Class definition:
|
||||||
@ -67,7 +69,6 @@ Class definition:
|
|||||||
$from = 'email@email.com',
|
$from = 'email@email.com',
|
||||||
$ss_template = 'MyEmail';
|
$ss_template = 'MyEmail';
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
@ -77,7 +78,6 @@ Usage:
|
|||||||
$email = new MyEmail();
|
$email = new MyEmail();
|
||||||
$email->populateTemplate(Member::currentUser()); // This will populate the template, $to, $from etc variables if they exist
|
$email->populateTemplate(Member::currentUser()); // This will populate the template, $to, $from etc variables if they exist
|
||||||
$email->send(); // Will immediately send an HTML email with appropriate plain-text content
|
$email->send(); // Will immediately send an HTML email with appropriate plain-text content
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
### Administrator Emails
|
### Administrator Emails
|
||||||
|
Loading…
Reference in New Issue
Block a user