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

Amigo 2019-07-08 07:39:49 +02:00
parent d9f63d2416
commit f1c226ac7f
1 changed files with 2 additions and 2 deletions

@ -49,7 +49,7 @@ These(see video) are the DKIM values that would be needed in the component to be
### Error Checking For Emails In Code
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 that 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. [00:10:57](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m57s) So it's a way to store the message, so that the users, if they login, can see messages sent to them. That is the function of the Store Message. This Custom Method can be updated and changed, (pause the video), copy it. If you had written it just make sure that that part 'storemessage' is the same. [00:11:35](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m35s) That is implementing the Learning Manager Emailer 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. I had written this custom method. 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. [00:10:57](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m57s) So it's a way to store the message, so that the users, if they login, can see messages sent to them. That is the function of the Store Message. This Custom Method can be updated and changed, (pause the video), copy it. If you had written it just make sure that that part 'storemessage' is the same. [00:11:35](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m35s) That is implementing the Learning Manager Emailer in your component.
### Implemented Example
@ -63,6 +63,6 @@ Go to the code.(Editting the Admin View) [00:13:45](https://www.youtube.com/watc
In the 'Job Order' is a JavaScript area. The Send Email function may be seen which collects a set of values and transfers it to the 'sendEmail server' function, which sends it as a 'json' request to the server. [00:14:20](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m20s) The 'sendEmail' is the 'task' and when it gets a response, it gives the notification.
In the 'Job Order' is a PHP area. How to use the Ajax class had been explained in previous tutorials but just a brief touch on it again. [00:14:47](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m47s) Here is the input(ajax input) where the controller has to be set up . In the controller there is 'sendEmail' class that was defined in this field (see video). [00:15:12](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m12s) There are three variables, and should be filtered and are transfered to these methods and then should be logged in 'User' by selecting 'Yes'. Looking at the code, again this is the task 'sendEmail', it triggers the task and checks for those values, then transfers it to this method 'sendMail' which is in the model. Go to Models and to Ajax. Scroll down to the 'sendEmail'. [00:15:47](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m47s) This is a Custom Script. In closing this, the Ajax method can be seen. This is another Custom method which had been written by VDM, it's called sendEmail, it gets the 'mail', the 'HTML' and the 'type'. It it does the necessary cleansing etc. [00:16:14](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m14s) The Email Helper is requested. Then the 'Send' method is used and the variables are transfered. Then set the 'result'. If the result is 'true', the user is notified, otherwise he receives the 'error'. [00:16:38](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m38s)
In the 'Job Order' is a PHP area. How to use the Ajax class had been explained in previous tutorials but just a brief touch on it again. [00:14:47](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m47s) Here is the input(ajax input) where the controller has to be set up . In the controller there is 'sendEmail' class that was defined in this field (see video). [00:15:12](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m12s) There are three variables, and should be filtered and are transfered to these methods and then should be logged in 'User' by selecting 'Yes'. Looking at the code, again this is the task 'sendEmail', it triggers the task and checks for those values, then transfers it to this method 'sendMail' which is in the model. Go to Models and to Ajax. Scroll down to the 'sendEmail'. [00:15:47](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m47s) This is a Custom Script. In closing this, the Ajax method can be seen. This is another Custom method which I had written., it's called sendEmail, it gets the 'mail', the 'HTML' and the 'type'. It it does the necessary cleansing etc. [00:16:14](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m14s) The Email Helper is requested. Then the 'Send' method is used and the variables are transfered. Then set the 'result'. If the result is 'true', the user is notified, otherwise he receives the 'error'. [00:16:38](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m38s)
This email body is of great help to build the email and it ensures that it contains the necessary HTML etc.[00:17:15](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m15s) The HTML and subject can be passed to it and it simply adds the subject to the email and the necessary places as well as the body($body[]_$html) in the necessary place, and gets send in a appropriate way. A custom method is passed which gets the data from the Ajax and then sends it. [00:17:43](https://www.youtube.com/watch?v=tp6mMUTOF2Y&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m43s) That's a quick tutorial on how to implement sending emails through your component, using the Email Helper Class. The Email Helper Class is available on GitHub in the Component Builder.