Hi all.
I'm hoping someone can help me with getting the WebPlatform to email me automatically on an event (button push).
I've been working with the SMTPDemo.c file, but haven't had any success yet.
I have successfully used the email demo, sending emails through gmail's smtp service with SSL.
I think the problem might be incorporating SSL into the smtpdemo. I've added the line.........
SMTPClient.UseSSL = TRUE; into the parameters, no luck.
I also may not be implementing the function correctly. Anyone have any ideas??
Thanks to everyone here, I wouldn't have gotten as far as I have without the information here. I'm not a pro and much of this is new to me. C is not a favorite of mine, but I'm learning , my mcu programming has been mostly assembly language upto this point. I'm working on a home automation setup and I can control relays, get the temperature and light level etc. This auto-email thing has me stumped right now.
Thanks in advance. :) ,
noob
If I remember correctly, at least in Europe you had to purchase (At a ridiculous price, since it is something that was intended to be free) SSL libraries. Something to do with importing some kinds of cryptographic tecnology.
The demo was very simple (I made it work some years ago, with a PIC18). Just take another look at config (Server, username, password...)
And I think that in TCPCongig.h you need to add a global flag for SSL (Not just SSL for SMTP, I mean "general SSL client libraries").
Sorry for not being more specific, as I said, made it work a lot of time ago, and discarded it... So I remeber very few.
Hope it helps.
[quote author="mmmike"]
I've been working with the SMTPDemo.c file, but haven't had any success yet.
[/quote]
I have successfully used the email demo, sending emails through gmail's smtp service with SSL.
Which is it? :)
The Microchip demo for the web platform included an SMTP demo that works without SSL. SSL required an additional library which had to be purchased from Microchip on CD and, not having the need, I didn't bother.
[quote author="dpropicweb"][quote author="mmmike"]
I've been working with the SMTPDemo.c file, but haven't had any success yet.
[/quote]
I have successfully used the email demo, sending emails through gmail's smtp service with SSL.
Which is it? :)
The Microchip demo for the web platform included an SMTP demo that works without SSL. SSL required an additional library which had to be purchased from Microchip on CD and, not having the need, I didn't bother.[/quote]
Hi gentlemen, thanks for the replies.
As far as the SSL goes, I have the encryption libraries and have used them successfully with the "email demo".
The "SMTPDemo" is a different thing all together. It does not work through a webpage, it uses real world button pushes. I'm sure I have all of the parameters entered correctly and the proper bits un-commented.
After gazing at code for a while last night, I do not think my issue is with the SSL. I'm leaning more toward a lack of understanding of C language on my part. Maybe I am not implementing the function correctly. It should be waiting in the background looking for button activation. Here is the code from Microchip's SMTPDemo.c, unaltered. I am using the first part, which is supposed to send a simple message with no attachments.
eta: Sorry, I couldn't attach the code, the forum thinks this was spam. Just look at the file if you have the microchip solutions stuff
Ok. Well, I don't have the current MCHP solutions library to hand, but I suspect you will need to change the hardware config for the button in that demo so that it matches the web platform hardware (if you haven't already).
That's the one I was talking: It worked, at least in previous versions.
You just need to be sure the function is called in your main function. And trigger the email sending, with a button in the demo (I changed that to a variable when I was trying it in order to send a mail every XX seconds). Anyway, you just need to be sure that the function is called in your main loop, and that the conditions for sending the mail are present. It works out of the box (Or at least, as I said, used to work...)
You can paste the code in the message, using the "code" tags:
[code]code that you want to show[/code]
Thanks for the tips. I should have a little time today to go through it again.
I'll let you know what I find.
Still no luck. I wish I knew exactly where it is failing. I'll keep poking it :)
SOLVED! WOOHOO!
After stepping away from this for a while, I took a fresh look at it yesterday.
I was going over the Microchip demos that used this function and found the line:
void SMTPDemo(void);
in the MAINDemo.h file. I had not previously thought of looking there because the webPlatform version of the demo does not really use this file for anything.
So now that it is working, it's on to modifying it for my purposes.
One of the things I am going to do is install a float switch by my sump pump that will activate if the pump fails. This will alert me through email and text. One issue I am anticipating is that a switch like this will bounce on/off for a while as the water level rises. I would like to have a long delay built into this function that will eliminate a barrage of messages coming in.
Does anyone know of a delay routine that works in minutes, rather than us and ms? those are all I can find after a quick search.
THANKS EVERYONE!
[quote author="mmmike"]Does anyone know of a delay routine that works in minutes, rather than
us and
ms? those are all I can find after a quick search.[/quote]
There is a GetTick() function used by the demo for some timing stuff. I used it in my own project. You can even do hours I believe.
if((TickGet() - StoredTicks) >= TICK_MINUTE){
DoStuff;
}
is kinda how you use it. Check out the heartbeat LED on the demo, MainDemo.c file, the section is:
// Line 51
TickInit(); //setup the tick timer
// Line 78
if((TickGet() - ticks) >= (TICK_SECOND/2)){ //blink LED
ticks = TickGet();
LED0_IO ^= 1;
}
Thanks for the quick reply tayken.
The tick.h file does have a TICK_HOUR and TICK_MINUTE feature.
I'll be playing with those while developing my code.
BIG THANKS!