diff --git a/025-How-to-use-email-helper-in-your-components.md b/025-How-to-use-email-helper-in-your-components.md index adde5a2..4889196 100644 --- a/025-How-to-use-email-helper-in-your-components.md +++ b/025-How-to-use-email-helper-in-your-components.md @@ -40,29 +40,19 @@ The DKIM area is the more advanced area which allows encryption and to authentic ### Default Global In Code -On the code level(See video), it gets the 'mailer' function from the configuration and checks whether it is Global. If it is, then it implements Joomla's values. If it's not global, it implements your components values. [00:07:38](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m38s) Read through the code, the most important area is this 'send' area to see all the various options in the signature to send out mail. [00:08:04](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m04s) It is able to send large quantities of mail but nonetheless your servers limitations should be considered. To avoid spams to be send, this values has not been overrided. The Joomla default Helper 'jmailer' is simply been used which has been extended from another class.(See video) [00:08:35](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m35s). +On the code level(See video), it gets the 'mailer' function from the configuration and checks whether it is Global. If it is, then it implements Joomla's values. If it's not global, it implements your components values. [00:07:38](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m38s) Read through the code, the most important area is this 'send' area, there the various options in the signature to send out mail may be observed. [00:08:04](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m04s) It is able to send large quantities of mail but nonetheless your servers limitations should be considered. To avoid spams to be send, this values has not been overrided. The Joomla default Helper 'jmailer' is simply been used which has been extended from another class.(See video) [00:08:35](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m35s). More information about the 'jmailer' Class may be found at Joomla. ### DKIM Values In Code -These(see video) are the DKIM values that would be needed in the component to be able to use the DKIM encryption. Do some research on this and check how this function implements these features. It gets added to the '$mailer' and most of the work is done in the '$mailer'. [00:09:05](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m05s) It adds the data to the mailer and the mailer takes care of the rest and it is send out.<<<<<<<<<<<<<<<<<< - - - - - - - - - - - - - +These(see video) are the DKIM values that would be needed in the component to be able to use the DKIM encryption. Do some research on this and check how this function implements these features. It gets added to the '$mailer' and most of the work is done in the '$mailer'. [00:09:05](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m05s) It adds the data to the mailer and the mailer takes care of the rest and it is send out. ### Error Checking For Emails In Code -And if there is an error, let's say for some reason it didn't work out well. Then it checks whether your component helper class, your component has a helper class, it's this file here(learningmanagerhelper). [00:09:31](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m31s) If it have a storemessage variable or method. So if we were to go check this. You see that there is the storemessage method in the helper class. This is a custom method that I wrote. You can write it anywhere you like, but this signature should be the same. [00:10:00](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m00s) So basically this area that(learningmanager) and that(learningmanager) is dynamically updated to your component. It uses your component name here(learningmanager) and your component name there(learningmanager). But this storemessage cannot be changed, but it takes the send email, the recipient, the subject, the body, the text only, the mode and it's says that it's emailed. So you can have different types, so if you look at the method, the type can be anything. [00:10:30](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m30s) We want to do different things on different types. If it send an SMS and it didn't fail, you want to store the message. This kind of feature isn't only used when something didn't work, but also if it worked. If it was sent, it's going to store it. So it's a way to store the message,myou can [00:10:57](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m57s) let your user go, if they login, they can see messages sent to them and this kind of stuff. This is what the store message does. You will see that it's whole huge custom method that I wrote. You can update it and change it, pause the video, copy it down. If you realize this is actually something you write up yourself you just need to make sure that that part is the same. The rest is up to you how you deal with it. That is implementing the learning manager emailer [00:11:35](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m35s) in your component. +If for instance an error occurres, then it verifies whether the component Helper Class, (this file 'learningmanagerhelper'). has a 'storemessage' variable or method. [00:09:31](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m31s) It can be seen that there is the 'storemessage' method in the Helper Class. This is a custom method had been written by VDM. It may be written anywhere, but the signature should be the same. [00:10:00](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m00s) These(See video) 'learningmanager' areas is dynamically updated to your component. It uses the component name 'learningmanager' and the component name 'learningmanager'. But this 'storemessage' cannot be changed, but it takes the 'send email', the 'recipient', the 'subject', the 'body', the 'text only', the 'mode' and indicates that it is 'email'. So there may be different types, and looking at the method, the type can be anything. [00:10:30](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m30s) Different things need to be done on the various types. If the SMS didn't fail, the message needs to be stored. This kind of feature isn't only used when something didn't work, but also when it worked. If it had been send, it will be stored.<<<<<<<< + + + So it's a way to store the message,myou can [00:10:57](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m57s) let your user go, if they login, they can see messages sent to them and this kind of stuff. This is what the store message does. You will see that it's whole huge custom method that I wrote. You can update it and change it, pause the video, copy it down. If you realize this is actually something you write up yourself you just need to make sure that that part is the same. The rest is up to you how you deal with it. That is implementing the learning manager emailer [00:11:35](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m35s) in your component. ### Implemented Example