Updated 025 How to use email helper in your components (markdown)

Amigo 2019-07-02 12:11:46 +02:00
parent 39196070a0
commit 042e38e0e3
1 changed files with 7 additions and 4 deletions

@ -2,19 +2,22 @@
* ### Example Of Email Helper Class
The Email Helper Class is a class that gets added to components Helper area and is therefore available on every page, with which Emails can be send. For example: Take a look at the Helper Class by going to a component that has it included and at 'Helpers'. [00:00:25](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) The filename is usually the component name: 'Email'. As may be seen, it is in the basic abstract class. That takes Joomla's E-mailer, which is 'Jmail' and gets an instance of it, [00:00:48](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m48s) and adds it to mail and then loads in the variables that's required.
The Email Helper Class is a class that gets added to Components Helper area and is therefore available on every page, with which Emails can be send. For example: Take a look at the Helper Class by going to a component that has it included and at 'Helpers'. [00:00:25](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) The filename is usually the component name: 'Email'. As may be seen, it is in the basic abstract class. That takes Joomla's E-mailer, which is 'Jmail' and gets an instance of it, [00:00:48](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m48s) and adds it to mail and then loads in the variables that's required.
### Setting Up Email Helper Class
If this feature is going to be used, the first thing to do when looking at a component (On Component Builder Dashboard) is to open 'Learning Manager' and go to Libs & Helpers. [00:01:22](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m22s) It may be noticed that the 'add email helpers' has been set to 'on'. It places the Helper class in the component, but is not implemented anywhere else. That means that if 'yes' is clicked, it is still necessary to create fields, that need to get loaded to the config area. <<<<<<<<<<<<<<<<<<<<<<<<<<
If this feature is going to be used, the first thing to do when looking at a component (On Component Builder Dashboard) is to open 'Learning Manager'(In Editing the Component area) and go to Libs & Helpers. [00:01:22](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m22s) It may be noticed that the 'add email helpers' has been set to 'on'. It places the Helper class in the component, but is not implemented anywhere else. That means that if 'yes' is clicked, it is still necessary to create fields, that need to get loaded to the config area.
### Settings - Config Area
Now if you don't know about the config yet, it means you've skipped some tutorials, but it's basically this(config) area here. [00:01:55](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m55s) Which gives you the ability to add configuration options to your components option area. So if we click here(config - add) I scroll down you'll see that there is mail configuration and a whole lot of fields there. Now these fields correspond to the Joomla's default fields, if you didn't know. If you would like to create these fields and you need some info on what there should be in, what should be their names and everything. Then go look at the Joomla global configuration XML. And you'll see all the settings in that file. For our purposes I'm simply going to show you how the fields look like. [00:02:39](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m39s) We also have the DKIM implementation available.
In 'Settings' is this 'config' area.(Adding Custom Config Fields) [00:01:55](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m55s) Which gives the ability to add configuration options to the components option area. So if this 'config - add' is being clicked, scroll down till that mail configuration and a whole lot of fields may be seen. These fields correspond to the Joomla's default fields. If you would like to create these fields and you need.........If some info is needed in order to create these fields, like what should their names and content be. Then go and look at the Joomla Global Configuration XML and all the settings in that file may be seen. [00:02:39](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m39s) There is DKIM implementation available.
### In Code Field Names
Even those fields you will need to look at the code to know what their names should be. So there's a difference of course between name and label and description. When we refer to name that is the value that will be used in the code. I'll show you what I mean. Go back to the code. For example that word mailer [00:03:13](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m13s) means that the name of the field is called mailer. The name of the field is called that and that and so it goes on. So these are all the fields that needs to be set.
It will be necessary to look in the code to get these field's names. There is a difference between 'name', 'label' and 'description'. When we refer to name that is the value that will be used in the code. In the code for example, that word 'mailer' [00:03:13](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m13s) means that the name of the field is called 'Mailer' and the same applies to the name 'field' etc. These are all the fields that needs to be set.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
### Component Global Options - Mail Configuration