Jump to content
Javascript Disabled Detected
You currently have javascript disabled. Several functions may not work. Please re-enable javascript to access full functionality.
The Netduino forums have been replaced by new forums at
community.wildernesslabs.co .
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
12 replies to this topic
#1
Larre
Posted 30 December 2012 - 09:53 PM
Hi,
I am trying to send email from my Netduino Plus 2 using the Toolbox.NETMF.NET framework but I get a System.ArgumentOutOfRangeException no matter what I do.
My code:
using Toolbox.NETMF.NET;namespace SendMail{ public class Program { public static void Main() { // write your code here SMTP_Client.MailContact from = new SMTP_Client.MailContact("test@test.net"); SMTP_Client.MailContact receiver = new SMTP_Client.MailContact("test@test.net"); SMTP_Client.MailMessage message = new SMTP_Client.MailMessage("test"); message.Body = "Hello World!"; IntegratedSocket integratedSocket = new IntegratedSocket("smtp.gmail.com", 587); SMTP_Client client = new SMTP_Client(integratedSocket, SMTP_Client.AuthenticationTypes.None, "test@test.net", "test"); client.Send(message, from, receiver); } }}
In the line where I create the "client" the following error is thrown:
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Uncaught exception
The thread '<No Name>' (0x1) has exited with code 0 (0x0).
Any ideas where I go wrong?
Using NETMFToolbox 21098, rel 4.2
Regards, Larre
#2
Stefan
Stefan
Location Breda, the Netherlands
Posted 30 December 2012 - 10:30 PM
Well, you're using SMTP_Client.AuthenticationTypes.None but still using a user/pass. That's a bit odd really.
Also, GMail doesn't support SMTP over plain text with authentication.
I read a possible work-around here: http://cavewall.jagu...out-ssl-part-1/
But it's not really supported by google from what I understand.
#3
Larre
Posted 30 December 2012 - 11:35 PM
Sorry, the SMTP_Client.AuthentcationTypes.None was just a rest from my experiments, didn't tidy up the code before posting.
I have tried the following line also to no avail:
SMTP_Client client = new SMTP_Client(integratedSocket, SMTP_Client.AuthenticationTypes.Login, "test@test.net", "test");
And now also tried this one with server and port according to your suggested work-around:
SMTP_Client client = new SMTP_Client(integratedSocket, SMTP_Client.AuthenticationTypes.None);
I get the same error using either line. Do you think it can be related to my email server? I'll do some more tests tomorrow with another email server.
Thanks, Larre
#4
Larre
Posted 31 December 2012 - 08:37 AM
I tried setting up an account with GMX as suggested in a few other posts but I still got the error so I suspect that I have done something else wrong.
Full output trace:
Create TS. Loading start at 806a328, end 808443cAssembly: mscorlib (4.2.0.0)Assembly: Microsoft.SPOT.Native (4.2.0.0)Assembly: Microsoft.SPOT.Hardware (4.2.0.0)Assembly: Microsoft.SPOT.Net (4.2.0.0)Assembly: System (4.2.0.0)Assembly: Microsoft.SPOT.Hardware.SerialPort (4.2.0.0)Assembly: Microsoft.SPOT.IO (4.2.0.0)Assembly: System.IO (4.2.0.0)Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1)Assembly: Microsoft.SPOT.Hardware.Usb (4.2.0.0)Assembly: SecretLabs.NETMF.Diagnostics (4.2.0.0)Assembly: SecretLabs.NETMF.Hardware.Netduino (4.2.1.0)Assembly: Microsoft.SPOT.Hardware.OneWire (4.2.0.0)Assembly: Microsoft.SPOT.Time (4.2.0.0)Loading Deployment Assemblies.Attaching deployed file.Assembly: Toolbox.NETMF.NET.SMTP_Client (4.2.0.0)Attaching deployed file.Assembly: Toolbox.NETMF.Core (4.2.0.0)Attaching deployed file.Assembly: SendMail (1.0.0.0)Attaching deployed file.Assembly: Toolbox.NETMF.NET.Core (4.2.0.0)Attaching deployed file.Assembly: SecretLabs.NETMF.Hardware (4.2.0.0)Attaching deployed file.Assembly: Toolbox.NETMF.NET.Integrated (4.2.0.0)Resolving.The debugging target runtime is loading the application assemblies and starting execution.Ready.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2Assemblieslemscorlib.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Native.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Net.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleSystem.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.SerialPort.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.IO.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleSystem.IO.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.PWM.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.Usb.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Secret LabsNetduino SDKAssembliesv4.2leSecretLabs.NETMF.Diagnostics.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Secret LabsNetduino SDKAssembliesv4.2leSecretLabs.NETMF.Hardware.Netduino.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.OneWire.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Microsoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Time.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'D:DownloadNetduinonetmftoolbox-21098Release (4.2)leToolbox.NETMF.Core.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'D:DownloadNetduinonetmftoolbox-21098Release (4.2)leToolbox.NETMF.NET.Core.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'D:DownloadNetduinonetmftoolbox-21098Release (4.2)leToolbox.NETMF.NET.SMTP_Client.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'D:DownloadNetduinonetmftoolbox-21098Release (4.2)leToolbox.NETMF.NET.Integrated.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'D:CodeNetduinoSendMailSendMailbinDebugleSendMail.exe', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program Files (x86)Secret LabsNetduino SDKAssembliesv4.2leSecretLabs.NETMF.Hardware.dll', Symbols loaded.The thread '<No Name>' (0x2) has exited with code 0 (0x0).A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dllAn unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll Uncaught exception The thread '<No Name>' (0x1) has exited with code 0 (0x0).Done.Waiting for debug commands...The program '[14] Micro Framework application: Managed' has exited with code 0 (0x0).
#5
OZ8ET
OZ8ET
Location Hundested, Denmark
Posted 27 March 2013 - 02:51 PM
I have the same problem - is it a v4.2 problem? I cannot get it to accept "IntegratedSocket".
I installed toolbox,
included Toolbox.NETMF.NET.SMTP_Client
using Toolbox.NETMF.NET;
IntegratedSocket integratedSocket = new IntegratedSocket("<smtp-server>", 587);SMTP_Client client = new SMTP_Client(integratedSocket, SMTP_Client.AuthenticationTypes.Login, "<username>", "<password>");client.Send(message, from, receiver); ?
#6
jbrowne
jbrowne
New Member
Members
4 posts
Posted 12 April 2013 - 03:51 PM
I have also tried the various examples above, and am also getting the ArgumentOutOfRangeException. It's not just Gmail either, because I've tried with a local smtp email server that accepts Auth, plaintext, and none.
#7
auggieben
auggieben
New Member
Members
2 posts
Posted 20 April 2013 - 01:04 AM
I'm getting the same error too, so I stepped into the code for 'SMTP_Client( )' and found the following suspicious code.
string Hostname = Tools.HardwareProvider.ToString();
this sets 'Hostname' to "Netduino". (so far so good).
int LastDot = Hostname.LastIndexOf('.');
this sets LastDot to -1 (what's it looking for, a version number?)
this._LocalHostName = Hostname.Substring(0, LastDot); <---- Exception thrown
I don't think the Substring method likes the -1 argument "LastDot"
Does anyone know how to correct this? Can we rebuild the library ourselves or is someone else in charge of this? Any workarounds?
#8
Stefan
Stefan
Location Breda, the Netherlands
Posted 21 April 2013 - 09:38 AM
Ahh that looks familiar. I'll fix it later today and publish an update.
#9
corythompson
corythompson
New Member
Members
6 posts
Posted 01 May 2013 - 06:34 PM
BUMP...
Hey guys.
I'm also looking for the solution to this problem.
Please help.
Posted 13 May 2013 - 09:30 AM
Stefan did you modified the code? It seems not in last 23314.
In the meanwhile this is my working code:
public SMTP_Client(SimpleSocket Socket, AuthenticationTypes AuthenticationType = AuthenticationTypes.None, string Username = "", string Password = "")
{
// Copies all parameters to the global scope
this._Socket = Socket;
this._SMTP_User = Username;
this._SMTP_Pass = Password;
this._SMTP_Auth = AuthenticationType;
// By default we fill the hostname with the name of the hardware itself. We need this to identify ourself
string Hostname = Tools.HardwareProvider.ToString();
int LastDot = Hostname.LastIndexOf('.');
//JJ start
if (LastDot > 0)
//JJ end
this._LocalHostname = Hostname.Substring(0, LastDot);
//JJ start
else
this._LocalHostname = Hostname;
//JJ end
}
#11
ChrisII
ChrisII
New Member
Members
1 posts
Posted 22 May 2013 - 06:42 PM
I am having the exact same problem.
Has this issue been fixed?
#12
herron
herron
New Member
Members
3 posts
Posted 02 July 2013 - 04:44 PM
Trying to fix the same problem. any solutions? still getting "An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll"
#13
brikesh987
brikesh987
New Member
Members
6 posts
Posted 21 June 2014 - 06:46 AM
I am also getting this error. Looks like this bug is not fixed. Did you guys find any other ways to send email?
Also tagged with one or more of these keywords: Toolbox.NETMF.NET, Netduino Plus 2, SMTP_Client, 4.2.1.2
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users
Reply to quoted posts Clear
Netduino Forums
→ Hardware
→ Netduino Plus 2 (and Netduino Plus 1)
Privacy Policy