SMTP with .NET Micro Framework
#21
Posted 29 January 2012 - 11:51 AM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#22
Posted 21 August 2012 - 11:30 PM
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.
Added [code] tags and masked the smtp password :)
#23
Posted 22 August 2012 - 06:13 AM
Hi,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
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
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#24
Posted 23 August 2012 - 02:29 AM
#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.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.
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
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#26
Posted 26 August 2012 - 03:37 PM
#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); } }
#28
Posted 21 June 2014 - 03:09 PM
Could you try the latest version at http://netmftoolbox.codeplex.com/ ?
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:
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 topic
0 members, 1 guests, 0 anonymous users