Sending mail with a Netduino Plus - Page 2 - Project Showcase - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


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.
Photo

Sending mail with a Netduino Plus


  • Please log in to reply
24 replies to this topic

#21 sGorges

sGorges

    New Member

  • Members
  • Pip
  • 3 posts

Posted 28 October 2013 - 11:53 PM

Has anyone had any issues using this to send email?

 

I have only had my Netduino Plus 2 for about a week, and I struggled to get it to send email.  I setup a new project following Stefan's instructions above (Thank you so much Stefan!!) and I tried to send email to my Gmail, GMX.com, and my AT&T accounts, but I continuously got errors trying to send the email.  The Netduino would send a "HELO" and I would get a response but was never able to login or send an email. I am a total nood and had to do a lot of research to figure out what was happening and what was supposed to happen.  I finally discovered that the commands in the _Send of the STMP_Client.cs were not sending the correct commands at the correct times.  I needed to send a "EHLO" instead of a "HELO" and the "AUTH LOGIN" needed to also include the UserID.

 

So my question is what changed?  Obviously a lot of people have been using this and it has been working fine.  I could not find anything on here about anyone else having these issues, So does anyone have any idea what is different?   I can now send email through mail.gmx.com and smtp.att.yahoo.com (port 587) but still cannot send email through Gmail so any guidance would be greatly appreciated. 

 

The commands that I finally got to work for GMX and AT&T are as follows:

// Reads and validates the first line of dataText = this._Socket.Receive(true);if (Text.Substring(0, 3) != "220") { Error = Text; break; }// Say "hello!"this._Socket.Send("EHLO " + this._LocalHostname + "rn");while (Text.Substring(4,8) != "STARTTLS"){   Text = this._Socket.Receive(true);   if (Text.Substring(0, 3) != "250") { Error = Text; break; }              // Authenticates with the LOGIN authentication typethis._Socket.Send("AUTH LOGIN " + Tools.Base64Encode(this._SMTP_User) + "rn");Text = this._Socket.Receive(true);if (Text.Substring(0, 3) != "334") { Error = Text; break; }// Sends the password, base64 encodedthis._Socket.Send(Tools.Base64Encode(this._SMTP_Pass) + "rn");Text = this._Socket.Receive(true);if (Text.Substring(0, 3) != "235") { Error = Text; break; }// Specifies the sender and validates the responsethis._Socket.Send("MAIL FROM:<" + From + ">rn");Text = this._Socket.Receive(true);if (Text.Substring(0, 3) != "250") { Error = Text; break; }// Specifies the receiver and validates the responsefor (int Counter = 0; Counter < Recipients.Length; ++Counter){   this._Socket.Send("RCPT TO:<" + Recipients[Counter] + ">rn");   Text = this._Socket.Receive(true);   if (Text.Substring(0, 3) != "250") { Error = Text; break; }}// Initializes data transferthis._Socket.Send("DATArn");Text = this._Socket.Receive(true);if (Text.Substring(0, 3) != "354") { Error = Text; break; }// Sends the actual datathis._Socket.Send(Data + "rn.rn");Text = this._Socket.Receive(true);if (Text.Substring(0, 3) != "250") { Error = Text; break; }


#22 TareqGamal

TareqGamal

    Member

  • Members
  • PipPip
  • 19 posts

Posted 12 June 2014 - 08:28 AM

I face the same problem with this line

My NetDuino is Netduino plus 2 with .net 4.3

 

Urrmm..  Stefan

 

I  copy your code  and follow your steps  

 

but finally when debugging  it's come out like this  " An unhandled exception of type 'System.NullReferenceException' occurred in mail.exe"

 

could you   help me resolve this stuck , please

                                                                            Very Thanks

 

We've try this code via Netduino Plus , and Plus 2 boths but the result is the same .

 

We've change one point from your pure code   because it's come out redline line mark at

SMTP_Client Sender = new SMTP_Client("smtp.gmx.com");

i right click and choose Constuctor.



#23 TareqGamal

TareqGamal

    Member

  • Members
  • PipPip
  • 19 posts

Posted 12 June 2014 - 10:18 AM

it seems because I have to download the last Version of the library



#24 brikesh987

brikesh987

    New Member

  • Members
  • Pip
  • 6 posts

Posted 23 June 2014 - 02:51 AM

I am facing the  same issue, I tried  using the EHLO command isntead of HELO and passing userId with AUTH LOGIN as suggested above. But now I get a 500 error when the DATA command is issued.

Hey Tareq,

 

Did it work for you? What other lib you had to download?



#25 Stephane

Stephane

    New Member

  • Members
  • Pip
  • 8 posts

Posted 26 June 2014 - 05:19 AM

According to the french l'ordinateur (the computer) is female. Lucky us :D

 

Actually it's male! Just to let you know :)

 

ordinateur

nom masculin

(latin ordinator, celui qui met en ordre, de ordinare)

 
  • Machine automatique de traitement de l'information, obéissant à des programmes formés par des suites d'opérations arithmétiques et logiques.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.