Skip to content

026 How to setup a store message method along side the email helper class

Llewellyn van der Merwe edited this page Dec 19, 2018 · 14 revisions

Hi I've already done a tutorial how to use the email helper in your components And that it or I'll actually do touch upon The storing of messages Or emails for that matter Once it's been sent Now I would like to just look at that again For those of you that may just be wanting to know that So Obviously at this stage you should know That the email helper class Basically added to the helper folder Of your components backend So and it's usually called your components name and then email That's that's the email help class so to use it In the custom script you could use the three basic brackets Is that ok and then component like that And then just email And send And That is how you would basically construct Your Your script I show that as well in the tutorial We we going to more depth How to use the email helper But At the very bottom of this class in the sent Method There is a little snippet What is significant as it may seem Actually gives you a very great Affinity Because The result Of the email that was sent Is placed in sent email This result is passed to the method as well The first it looks in your helper class Which is usually a component name Helper That's the helper class And whether this method exists in the class And this method will not exist unless you Write it So The area where you would have to write this method Is in the component there is an area Called Admin helper Let's look at that Open a component We go to libraries and helpers Scroll down And we see there is Email helper And then underneath it help her at mint class And it's in this area that you need to add that method Now I realised I've chosen the wrong components is this component actually does not use that storage But there is another one that does let's open that one instead then So again we are in Helper admin class And we have a function called Star message and this is in the components There where you edit your component So this store message has what we call a signature Values that it is passing to the method And in the The Email helper class You see that it Also has A signature But wherever it gives this = with a value That means that that's the default value so if you do not add A value for this position there is one two three four 50 Then it will default 20 if we do not add this it will default to now So From there all the way to the end all of those values halves that basically than all No value So In reality you only need to add you know these values the first for But Those values are all used in this method So do you wanna understand exactly how these value should look look inside of the method Read through the method And you will see So Making a long story short We end up here at this Lil script Basically ask whether you created the method or not If you didn't it's simply skip said and returns the value of sent mail if it That you have created it It'll pass these variables that correspond to the signature And then inside her that method that is in your helper class That is now of this method You need to do the necessary checks and balances And discovering For example since you've got the email address You can Search Navigate bar In the user class It must equal Email Recipient = email And then returns to us the ID So That is basically how the get War works And Then when we have the user ID We can obviously make sure it's so The number and we said it to her message as user And we said it as the email and now we can store The message in whatever table or do whatever we wanna do Beyond The normal So even if you wanna do other things except Storing the message This is the method inside of which you can do it so store message Is the method inside which you can do some more custom scripting On top of your email integration Ok so that's just quickly giving a little bit more depth on that specific aspect Abusing The email class in your component Thank you for watching

Clone this wiki locally