How to send an Email with Arduino and Ethernet Shield (W5100)

(Difference between revisions)
Jump to: navigation, search
Line 14: Line 14:
 
== Telnet Exercise with sending an Email<br/> ==
 
== Telnet Exercise with sending an Email<br/> ==
  
&nbsp;The following example request the NTP from a time server and send an email by communicating with an SMTP server<br/>SMTP&nbsp; = Simple Mail Transfer Protocol<br/><br/>The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encrypted).<br/><br/><br/>If you encounter problems you can check all the single steps of the SMTP server communication with TELNET<br/>1. Enabling Telnet Client in Windows 7<br/>&nbsp;&nbsp; http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx<br/>2. Start the DOS command window in Windows 7 and type telnet and return<br/>3. Then you see:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Microsoft Telnet>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in the DOS command window.<br/>4. Now type (in case of GMX):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; open smtp.gmx.net 25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (25 is the port number)<br/>5. The answer from the SMTP server will be: 220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}<br/>6. Then type:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AUTH LOGIN<br/>' 7. The answer from the SMTP server will be: 334 VXNlcm5hbWU6<br/>' 8. If you decode the&nbsp;&nbsp; VXNlcm5hbWU6&nbsp;&nbsp; for example here&nbsp;&nbsp; http://www.base64decode.org/<br/>'&nbsp;&nbsp;&nbsp; you will notice that the decoded text is Username:<br/>' 9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)<br/>'10. After this the SMTP server ask for the password (also Base64 encoded)<br/>'11. If you type in the wrong username or password the server's answer is 535 5.7.0 Incorrect username or password {mpXXX}<br/>'12. The correct username and password will be answerd by:&nbsp;&nbsp; 235 2.7.0 Go ahead {mpXXX}<br/>'13. ...<br/>'14. You can start the Email content with DATA and end it with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt; which is in Bascom {013}{010}.{013}{010}<br/><br/>
+
&nbsp;The following example request the NTP from a time server and send an email by communicating with an SMTP server<br/>SMTP&nbsp; = Simple Mail Transfer Protocol<br/><br/>The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encrypted).<br/><br/><br/>If you encounter problems you can check all the single steps of the SMTP server communication with TELNET<br/>1. Enabling Telnet Client in Windows 7<br/>&nbsp;&nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]<br/>2. Start the DOS command window in Windows 7 and type telnet and return<br/>3. Then you see:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Microsoft Telnet>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in the DOS command window.<br/>4. Now type (in case of GMX):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; open smtp.gmx.net 25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (25 is the port number)<br/>5. The answer from the SMTP server will be: 220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}<br/>6. Then type:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AUTH LOGIN<br/>7. The answer from the SMTP server will be: 334 VXNlcm5hbWU6<br/>8. If you decode the&nbsp;&nbsp; VXNlcm5hbWU6&nbsp;&nbsp; for example with the Easy TCP/IP Tool in Bascom-AVR<br/>&nbsp;&nbsp;&nbsp; you will notice that the decoded text is Username:<br/>9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)<br/>10. After this the SMTP server ask for the password (also Base64 encoded)<br/>11. If you type in the wrong username or password the server's answer is 535 5.7.0 Incorrect username or password {mpXXX}<br/>12. The correct username and password will be answerd by:&nbsp;&nbsp; 235 2.7.0 Go ahead {mpXXX}<br/>13. ...<br/>14. You can start the Email content with DATA and end it with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt; which is in Bascom {013}{010}.{013}{010}<br/>
  
 
== Under Construction<br/> ==
 
== Under Construction<br/> ==

Revision as of 00:37, 10 March 2013

Contents

Used Hardware

  • Arduino UNO R3
  • Ethernet Shield with W5100 Wiznet Chip  

Used Software

Bascom-AVR 2.0.7.6

Windows8


Telnet Exercise with sending an Email

 The following example request the NTP from a time server and send an email by communicating with an SMTP server
SMTP  = Simple Mail Transfer Protocol

The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encrypted).


If you encounter problems you can check all the single steps of the SMTP server communication with TELNET
1. Enabling Telnet Client in Windows 7
   http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx
2. Start the DOS command window in Windows 7 and type telnet and return
3. Then you see:         Microsoft Telnet>         in the DOS command window.
4. Now type (in case of GMX):             open smtp.gmx.net 25             (25 is the port number)
5. The answer from the SMTP server will be: 220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}
6. Then type:         AUTH LOGIN
7. The answer from the SMTP server will be: 334 VXNlcm5hbWU6
8. If you decode the   VXNlcm5hbWU6   for example with the Easy TCP/IP Tool in Bascom-AVR
    you will notice that the decoded text is Username:
9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)
10. After this the SMTP server ask for the password (also Base64 encoded)
11. If you type in the wrong username or password the server's answer is 535 5.7.0 Incorrect username or password {mpXXX}
12. The correct username and password will be answerd by:   235 2.7.0 Go ahead {mpXXX}
13. ...
14. You can start the Email content with DATA and end it with <CR><LF>.<CR><LF> which is in Bascom {013}{010}.{013}{010}

Under Construction

.....

SMTP Server Reply Codes

Code Description


211 System status, or system help reply.
214 Help message.
220 Domain service ready.Ready to start TLS.
221 Domain service closing transmission channel.
250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.
251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.
252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.
253 OK, messages pending messages for node node started.
354 Start mail input; end with <CRLF>.<CRLF>.
355 Octet-offset is the transaction offset.
421 Domain Service Not Available , Closing Transmission Channel.
432 A password transition is needed.
450 Requested mail action not taken: mailbox unavailable.ATRN request refused.
451 Requested action aborted: local error in processing.Unable to process ATRN request now
452 Requested action not taken: insufficient system storage.
453 You have no mail.
454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.
458 Unable to queue messages for node node.
459 Node node not allowed: reason.
500 Command not recognized: command.Syntax error.
501 Syntax error, no parameters allowed.
502 Command not implemented.
503 Bad sequence of commands.
504 Command parameter not implemented.
521 Machine does not accept mail.
530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.
534 Authentication mechanism is too weak.
538 Encryption required for requested authentication mechanism.
550 Requested action not taken: mailbox unavailable.
551 User not local; please try forwardpath.
552 Requested mail action aborted: exceeded storage allocation.
553 Requested action not taken: mailbox name not allowed.
554 Transaction failed.

Under Construction

......

Personal tools
Namespaces
Variants
Actions
Navigation
Language