1 00:00:00,540 --> 00:00:07,530 Hello and welcome to the stimulus, one in which are going to start writing our quote, the quote that 2 00:00:07,530 --> 00:00:17,340 we are going to write and this lesson will help send an email via us A.P. server with e-mail or text 3 00:00:17,340 --> 00:00:23,490 or any other thing that you want to send now for the sake of testing. 4 00:00:23,490 --> 00:00:32,670 We are only sending an email once when they ask you to board boats and we can change this later depending 5 00:00:32,670 --> 00:00:39,080 on our project or our specific properties or what we want. 6 00:00:39,600 --> 00:00:43,260 Now, you should be able to create the code easily. 7 00:00:43,290 --> 00:00:51,450 I will go with you on a step by step manner and we will start by creating a new Arduino project. 8 00:00:52,380 --> 00:00:54,450 Then let's save this project. 9 00:00:55,530 --> 00:00:57,990 To make sure that we save our work. 10 00:01:00,050 --> 00:01:03,450 Let's call it code now. 11 00:01:03,620 --> 00:01:11,990 The first thing that we need to do is include some libraries, so it will start with hashtag include, 12 00:01:13,250 --> 00:01:25,190 then we can add the library name, which is E.S.P 30 to underscore male client TotEx, which is basically 13 00:01:25,940 --> 00:01:31,250 the library that we did, and using the managed libraries. 14 00:01:31,250 --> 00:01:32,960 We did that in a previous class on. 15 00:01:34,790 --> 00:01:43,690 The main library now we need to insert our network credentials, so let's add two variables. 16 00:01:43,880 --> 00:01:56,630 The first one is a constant character for the network credential as a side, and my network name is 17 00:01:56,630 --> 00:01:57,560 Ashraf TV. 18 00:02:00,110 --> 00:02:08,270 And we also need to enter a password, so we'll have to write constant characters. 19 00:02:10,880 --> 00:02:11,600 Password. 20 00:02:14,660 --> 00:02:16,760 And we'll have to enter our password. 21 00:02:21,590 --> 00:02:24,200 I don't remember my password, but I will. 22 00:02:27,660 --> 00:02:32,550 OK, I will use this one now. 23 00:02:33,180 --> 00:02:40,680 We need to enter our e-mail settings, so you need to enter that email account and the password for 24 00:02:40,680 --> 00:02:41,940 the emails and their account. 25 00:02:41,940 --> 00:02:44,850 So you need to define your variables. 26 00:02:46,080 --> 00:02:50,970 So let's try define e-mail sender count. 27 00:02:52,020 --> 00:03:00,720 And we already know that our email is you and Angie team and Agema dot com. 28 00:03:03,840 --> 00:03:08,420 Now we also have to define the password. 29 00:03:09,000 --> 00:03:10,740 So email Cynda. 30 00:03:13,170 --> 00:03:17,030 Passwords, we need to have the password here. 31 00:03:17,250 --> 00:03:20,680 I want to write it out like that when we are testing. 32 00:03:21,090 --> 00:03:30,120 Now you want to enter or you must enter that SEIP email account or the one who received the e-mail account 33 00:03:30,270 --> 00:03:31,740 from your ISP board. 34 00:03:32,220 --> 00:03:42,540 This is the email that we received, that email sent by our ISP to do that by design and then by email 35 00:03:43,650 --> 00:03:44,340 subbrand, 36 00:03:47,790 --> 00:03:50,700 then write the email. 37 00:03:50,820 --> 00:03:52,290 I will send the emails to my. 38 00:03:54,750 --> 00:03:58,970 You and your team at Gmail dot com, which is our. 39 00:04:00,470 --> 00:04:09,770 E-mail, OK, now you need to enter your address and TB settings, and we did explain in the previous 40 00:04:09,770 --> 00:04:19,160 Lassonde that some TB server settings for Gmail outlook and Hotmail account, they are consistent values 41 00:04:19,160 --> 00:04:21,250 provided by each of these companies. 42 00:04:21,260 --> 00:04:24,680 So you just need to copy and paste the values. 43 00:04:24,680 --> 00:04:27,980 And since we are using Gmail, it will be easy. 44 00:04:29,210 --> 00:04:33,110 Now, let's start by adding some TEEB server. 45 00:04:35,700 --> 00:04:47,710 So I define then FTB server and I assume to be the Gmail dot com. 46 00:04:48,940 --> 00:04:53,210 Next, we need to assign the support for this assumptive server. 47 00:04:53,340 --> 00:05:04,380 So I define a TV server port and then write the number four hundred sixty five. 48 00:05:05,800 --> 00:05:16,200 Now we need to write the email subject so we can also use define, define email subject 49 00:05:18,450 --> 00:05:19,980 and we can. 50 00:05:20,430 --> 00:05:27,680 But E.S.P 32 just think email. 51 00:05:29,820 --> 00:05:36,840 Now that we have done all of this, we need to create an awesome TB data object and we can call it a 52 00:05:37,080 --> 00:05:43,770 TB data that contains the data to send via email and all other configurations. 53 00:05:44,220 --> 00:05:55,740 So simply right as TB data and name it as TB data that said. 54 00:05:56,670 --> 00:05:59,370 Now inside your set up. 55 00:06:00,560 --> 00:06:06,180 This is it for the configuration before the setup function. 56 00:06:07,580 --> 00:06:16,820 Now, inside the setup, we need to start the wi fi connection using lifeguarded begin, and we need 57 00:06:16,820 --> 00:06:26,060 to pass this aside for the network and the password to make sure that it will connect to our local Wi-Fi 58 00:06:26,060 --> 00:06:26,540 network. 59 00:06:26,790 --> 00:06:27,320 Now. 60 00:06:29,140 --> 00:06:38,230 We will use and if why not if statement, I want to make sure that we give people enough time to connect 61 00:06:38,800 --> 00:06:44,980 so and solve this, we are going to use the state of missile status 62 00:06:48,070 --> 00:06:49,340 if it is not equal. 63 00:06:49,390 --> 00:06:56,880 Wireless connected, then it means that Wi-Fi is not connected yet. 64 00:06:56,890 --> 00:07:05,910 And in that case, for debugging, we can print something, we can print a dot or a star. 65 00:07:07,120 --> 00:07:11,590 Then you need to add some delay to give it enough time to connect. 66 00:07:12,010 --> 00:07:17,820 Now, if it's not connected, it will keep printing stars until it connects. 67 00:07:18,430 --> 00:07:24,830 Maybe your Wi-Fi is offline or your username as ID or password are wrong. 68 00:07:25,450 --> 00:07:25,930 Now. 69 00:07:28,420 --> 00:07:29,320 After that. 70 00:07:30,390 --> 00:07:36,360 After we finish checking and making sure that we are connecting to our Wi-Fi network inside the setup, 71 00:07:37,260 --> 00:07:42,300 we need to set some TB data object details. 72 00:07:42,420 --> 00:07:45,690 So you must have some TB data. 73 00:07:46,770 --> 00:07:53,880 That said, Logan, we need to set the login information that we already defined here. 74 00:07:55,790 --> 00:08:05,930 So we will start with the first one, which is a SMTP server, in that case it's Google server and we 75 00:08:05,930 --> 00:08:13,760 need that server board, Stoebe Server Port, and we need the e-mails and that account. 76 00:08:16,460 --> 00:08:22,790 And we need the email Cynda password. 77 00:08:26,150 --> 00:08:35,410 So we need to pass all of these four values to this MTV data object, after that, we need to set that 78 00:08:35,420 --> 00:08:37,550 Zindani and send the email. 79 00:08:38,880 --> 00:08:39,420 So. 80 00:08:40,620 --> 00:08:43,110 We can use this MTV 81 00:08:45,540 --> 00:08:46,110 data. 82 00:08:50,100 --> 00:08:52,290 That sits in the function 83 00:08:54,870 --> 00:09:06,960 and will take E.S.P further to whatever you want to name it, Cynda, then we can provide that email 84 00:09:08,100 --> 00:09:09,810 Cynda account. 85 00:09:12,620 --> 00:09:22,100 Now we need to send the email priority and we have a high, low or medium, it's something you can't 86 00:09:22,100 --> 00:09:31,340 ignore, but I prefer adding high priority to make sure that we send it as high priority email. 87 00:09:34,270 --> 00:09:38,980 Now you can enter high, low, medium, or you can use numbers. 88 00:09:43,540 --> 00:09:55,570 OK, after doing that, we can send the email subject so as MTBE data that said, subject the subject 89 00:09:55,570 --> 00:10:02,110 for our email and we will use the one that we already found. 90 00:10:02,110 --> 00:10:07,990 Email subject will define this here, email subject. 91 00:10:07,990 --> 00:10:09,790 So we are using these variables. 92 00:10:12,020 --> 00:10:12,530 Now. 93 00:10:14,500 --> 00:10:19,210 We need to send the message itself, so we need to use assumptive data. 94 00:10:20,890 --> 00:10:22,510 It message. 95 00:10:25,430 --> 00:10:36,980 And inside to can plain text like Hello World, this is yes, we email this thing. 96 00:10:39,520 --> 00:10:48,670 To send raw data and need to add false here, or you can send e-mail data and we are going to explain 97 00:10:48,670 --> 00:10:52,420 this in the next lesson, but that's it for this lesson. 98 00:10:52,430 --> 00:10:53,530 Let's summarize. 99 00:10:53,530 --> 00:11:01,390 We included that, yes, be my client, BlackBerry, the Wi-Fi network name and password that's in the 100 00:11:01,390 --> 00:11:02,170 account. 101 00:11:02,170 --> 00:11:11,410 Email the sender password that received account, the one who received the message, the TB server information 102 00:11:11,440 --> 00:11:14,590 and port and the email subject. 103 00:11:14,800 --> 00:11:21,340 After that, we started the wi fi connection process and we waited until Wi-Fi is connected. 104 00:11:21,340 --> 00:11:22,540 We can add the line here. 105 00:11:23,560 --> 00:11:26,800 We can say serial, the print 106 00:11:29,320 --> 00:11:30,550 Wi-Fi is connected. 107 00:11:33,020 --> 00:11:39,590 Can then we passed the assumptive server details. 108 00:11:40,950 --> 00:11:49,360 So this that object that we already defined here as some TV data we did said that get information, 109 00:11:49,390 --> 00:11:57,030 the sender e-mail the priority of this email, the email subject and the message in plain text that 110 00:11:57,030 --> 00:12:02,790 said for this, listen to your next and what's your next lesson and what you are going to continue writing. 111 00:12:02,790 --> 00:12:08,070 Our very first called for e-mail alerts using eSport. 112 00:12:08,460 --> 00:12:09,180 Thanks for watching. 113 00:12:09,180 --> 00:12:11,610 This is Ashraf's from educational engineering team.