On this Craft Cms lesson you'll learn to setup transactional emails for user authentication and password resets.
It has been the best investment I made in my design journey so far. I would consider myself a novice but I honestly feel like I've gained a genuine professional insight into the process of creating a high-level website.
I'm an early adopter of the KreativePro Masterclass, and I love how well put together it is. Neftali takes you through each step of the process from paper sketches to marketing all with fun visuals & clear instructions!
Okay, so transactional emails. So from time to time, and especially in this project SVR, we're going to require to send some emails. You know, these emails are like the password reset email, an activation email when a new user is added. Right? And so, unfortunately, Craft does not come with any SMTP or anything like that.
If we go over to our settings, you'll see that craft comes with a couple of options to send email, which is the Sendmail or a Gmail. But these are not very secure options. What we want to do is use our custom SMTP and, there's a couple of services that allow, or provide that for us. So the most popular, of course we have sendGrid, which allows you to send emails through SMTP as well for free.
Another one is Mailgun, which also allows you to do a free trial. And it has a couple of interesting features. And then finally, my favorite of course, is postmark. The reason why I like postmark is cause it's got a plugin in our in the craft CMS store. So we can actually avoid all the steps of adding TLS and SSL.
We can just simply add a token directly into our setup and we're good to go. And the reason why we want to use these is because it's going to be reliable. The emails are most likely are going to arrive correctly and not into a spam folder if we set it up correctly, but there is a little bit of a configuration you'll need to be familiar with TLS and SSL and kind of test out some of their parameters that they provide.
So, to avoid doing that, we're going to go to our plugin store and we're going to access the plugin, that it's called postmark. And we're going to install that plugin and we're going to just connect it directly with our postmark account. All right, so what I've done is I've created an account and all you have to do is make sure you've installed the plugin into your craft.
And go into email. I can now select on the dropdown with the transport type postmark, but you'll notice that I've I'll need to include the server token. This is the API token that postmark provides when you go into your account and then click API tokens. Again, we can copy this and then we can add it into our .env file
and save that, go back to our settings reload, and simply swap that out with a variable. So Postmark. Variable postmark should appear API. And one thing to note is that postmark does not allow us to use public, email addresses. And so for example, this temporary address that I'm using is actually from a public server in Google.
So in this instance, we need to make sure that the system email address you're using to send these transactional emails matches the same as the URL or domain. Right now, if we wanted to test this out, it probably won't work because we have a different domain and different email address set up. So just to note, when you go public and upload to the production that we were going to look at in a later lesson, we're going to make sure that the email both matches the system and domain.
All right. So let's jump into the next lesson to talk about the sections and custom fields.
Access our premium community including bonus tutorials, project files & weekly resources.LIFETIME 💎 ACCESS