

![]() |
  | |||||||||||||
![]() |
|
![]() |
||||||||||||
![]() SMTP with .NET Micro Framework
Started by mpearson, Apr 26 2011 04:47 PM
30 replies to this topic
#21
Posted 29 January 2012 - 11:51 AM
True
![]() ![]()
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#22
Posted 21 August 2012 - 11:30 PM
I try to make this work but without success:
the problems is:// Initializes the mail sender class it does not know 'SimpleNETMFSocket" when I run this. with the two lines above there are similar problems. The one above says that it does not have 5 parameters. on the first one that is commented out it does not know what "IntegratedSocket" is. Your help is very much appreciated. Thanks using System; //using System.Net; //using System.Net.Sockets; //using System.Threading; //using Microsoft.SPOT; //using Microsoft.SPOT.Hardware; //using SecretLabs.NETMF.Hardware; //using SecretLabs.NETMF.Hardware.NetduinoPlus; //using Toolbox.NETMF; using Toolbox.NETMF.NET; //using Toolbox.NETMF.Hardware; namespace Mail { public class Program { public static void Main() { // By defining the CORRECT! date, mail messages could get a lower spam score in spam filters //Utility.SetLocalTime(new DateTime(2011, 10, 16, 20, 43, 0, 0)); // Defines the sender SMTP_Client.MailContact From = new SMTP_Client.MailContact("oehms@gmx.com", "Rainer Oehm"); // Defines the receiver SMTP_Client.MailContact Receiver = new SMTP_Client.MailContact("oehms@yahoo.com", "Rainer Oehm"); // Defines the mail message SMTP_Client.MailMessage Message = new SMTP_Client.MailMessage("Small test result"); Message.Body = "This mail is sent by a Netduino :-)\r\n"; Message.Body += "Good day!"; // Initializes the mail sender class // SMTP_Client Sender = new SMTP_Client(new IntegratedSocket("mail.gmx.com", 25)); // SMTP_Client Sender = new SMTP_Client("mail.gmx.com", 587, SMTP_Client.AuthenticationTypes.Login, "oehms@gmx.com", "*******"); SMTP_Client Sender = new SMTP_Client(new SimpleNETMFSocket("mail.gmx.com", 587), SMTP_Client.AuthenticationTypes.Login, "oehms@gmx.com", "*******"); // Sends the mail Sender.Send(Message, From, Receiver); } } }
Edited by Stefan, 22 August 2012 - 06:10 AM.
#23
Posted 22 August 2012 - 06:13 AM Hi, The SimpleNETMFSocket class has been replaced by the IntegratedSocket class, which can be found in the same package. If you download the toolbox, you'll need to include at least: \Framework\NET\Integrated\IntegratedSocket.cs \Framework\NET\SimpleSocket.cs \Framework\NET\SMTP_Client.cs \Framework\Tools.cs I believe that's it ![]()
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#24
Posted 23 August 2012 - 02:29 AM
Thanks for your fast response.
I added the code that you specified.
Now this line works: SMTP_Client Sender = new SMTP_Client(new IntegratedSocket("mail.gmx.com", 587));
However, it wants authentication, which this line does not provide.
The other two lines still have the same old problems.
SMTP_Client Sender = new SMTP_Client("mail.gmx.com", 587, SMTP_Client.AuthenticationTypes.Login, "oehms@gmx.com", "*******"); SMTP_Client
//it complains about not having a constructor with 5 parameters.
Sender = new SMTP_Client(new SimpleNETMFSocket("mail.gmx.com", 587), SMTP_Client.AuthenticationTypes.Login, "oehms@gmx.com", "*******");
//it does not know where to reference SimpleNETMFSocket. I changed it to IntegratedNETMFSocket, but that does not work either.
Any thoughts?
As always, thank you very much for your help.
#25
Posted 23 August 2012 - 06:09 AM That's because we just found out the class is called IntegratedSocket and not IntegratedNETMFSocket nor SimpleNETMFSocket. Try this: SMTP_Client Sender = new SMTP_Client(new IntegratedSocket("smtp.yourisp.com", 25), SMTP_Client.AuthenticationTypes.Login, "user", "pass"); See also http://netmftoolbox....NET.SMTP_Client for documentation btw ![]()
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#26
Posted 26 August 2012 - 03:37 PM
This is to thank you for your invaluable help.
I finally got it to work as you suggested. I had to use socket 587.
Again, without your support I would never haved gotten it to work.
It is very much appreciated.
#27
Posted 21 June 2014 - 07:05 AM Hello ,
I am using the following code. It's actually the same that you've suggested. But it give an exception private static void SendAlert() { // Defines the sender SMTP_Client.MailContact from = new SMTP_Client.MailContact("brikesh987@gmx.com", "Brikesh Kumar"); // Defines the receiver SMTP_Client.MailContact to = new SMTP_Client.MailContact("brikesh987@gmail.com", "Brikesh Kumar"); var recipients = new SMTP_Client.MailContact[2]; SMTP_Client.MailContact cc = new SMTP_Client.MailContact("brikesh987@gmail.com", "Brikesh Kumar"); recipients[0] = to; recipients[1] = cc; // Defines the mail message SMTP_Client.MailMessage Message = new SMTP_Client.MailMessage("Small test result"); Message.Body = "This mail is sent by a Netduino :-)\r\n"; Message.Body += "Good day!"; ushort port = 587; // Initializes the mail sender class try { SMTP_Client Sender = new SMTP_Client(new IntegratedSocket("mail.gmx.com", port), SMTP_Client.AuthenticationTypes.Login, "brikesh987@gmx.com", "****"); // Sends the mail Sender.Send(Message, from, recipients); } catch (Exception ex) { Debug.Print(ex.StackTrace); } } 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Hardware.Usb.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Secret Labs\Netduino SDK\Assemblies\v4.1\le\SecretLabs.NETMF.Hardware.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'SecretLabs.NETMF.Diagnostics'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Netmftoolbox.com\.NET Micro Framework Toolbox\Assemblies\v4.1\le\Toolbox.NETMF.Core.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Netmftoolbox.com\.NET Micro Framework Toolbox\Assemblies\v4.1\le\Toolbox.NETMF.NET.Core.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Netmftoolbox.com\.NET Micro Framework Toolbox\Assemblies\v4.1\le\Toolbox.NETMF.NET.Integrated.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Netmftoolbox.com\.NET Micro Framework Toolbox\Assemblies\v4.1\le\Toolbox.NETMF.NET.SMTP_Client.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Secret Labs\Netduino SDK\Assemblies\v4.1\le\SecretLabs.NETMF.Hardware.NetduinoPlus.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Work\MyProjects\Netduino\BabyMonitor\BabyMonitor\bin\Debug\le\BabyMonitor.exe', Symbols loaded.
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
#### Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE (1) ####
#### Message:
#### System.String::Substring [IP: 0000] ####
#### Toolbox.NETMF.NET.SMTP_Client::.ctor [IP: 002e] ####
#### BabyMonitor.Program::SendAlert [IP: 006a] ####
#### BabyMonitor.Program::Main [IP: 002e] ####
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
#### Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE (1) ####
#### Message:
#### System.String::Substring [IP: 0000] ####
#### Toolbox.NETMF.NET.SMTP_Client::.ctor [IP: 002e] ####
#### BabyMonitor.Program::SendAlert [IP: 006a] ####
#### BabyMonitor.Program::Main [IP: 002e] ####
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
System.String::Substring
Toolbox.NETMF.NET.SMTP_Client::.ctor
BabyMonitor.Program::SendAlert
BabyMonitor.Program::Main
The program '[8] Micro Framework application: Managed' has exited with code 0 (0x0).
Can you pllease help me out?
#28
Posted 21 June 2014 - 03:09 PM Could you try the latest version at http://netmftoolbox.codeplex.com/ ?
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#29
Posted 25 July 2014 - 01:07 PM Hi all,
I have the N+2 and I'm trying to get it to send emails. But I just can't.
I've tried lots of different things and read everything you guys have posted here, yet I'm still unable. This is my code, I tried to leave it as by default as possible: // Defines the sender SMTP_Client.MailContact From = new SMTP_Client.MailContact("isrusu@gmx.com", "Sori"); // Defines the receiver SMTP_Client.MailContact Receiver = new SMTP_Client.MailContact("is.rusu@gmail.com", "Ionut Sorin Rusu"); // Defines the mail message SMTP_Client.MailMessage Message = new SMTP_Client.MailMessage("Small test result"); Message.Body = "This mail is sent by a Netduino :-)\r\n"; Message.Body += "Good day!"; // Initializes the mail sender class SMTP_Client Sender = new SMTP_Client(new IntegratedSocket("mail.gmx.com", 587), SMTP_Client.AuthenticationTypes.Login, "isrusu@gmx.com", "xxxxxx"); Sender.Send(Message, From, Receiver); And this is the error:
An unhandled exception of type 'System.SystemException' occurred in Toolbox.NETMF.NET.SMTP_Client.dll
Additional information: 503 Bad sequence of commands
Could you please help me?
#30
Posted 26 July 2014 - 02:53 PM Accidenti!
I use the Toolbox in different ways (rtc, LCD display) but I can't get to male the the smtp client working....
I can't understand the ".ctor" error .....
But Great work Stefan!
Luca
#31
Posted 29 October 2014 - 04:24 PM From this post reply #10 static IPAddress mailip = IPAddress.Parse("192.168.1.15")
Can anyone tell me what this line relates to? More specifically what is this IP Address pointing to? gmail?, the posters PC?, the posters Netduino?
I've tried all three but the netduino never comes back from the connect command. Thanks 1 user(s) are reading this topic0 members, 1 guests, 0 anonymous users | ||||||||||||||
![]() |
||||||||||||||
![]() |
|
![]() |
||||||||||||
![]() |
This webpage is licensed under a Creative Commons Attribution-ShareAlike License. | ![]() |
||||||||||||
![]() |