Toolbox.NETMF.NET.SMTP_Client


Toolbox.NETMF.NET.SMTP_Client(Socket, AuthenticationType, Username, Password)
  • Socket A reference for the socket to be used (see also: SimpleSocket)
  • AuthenticationType The type of authentication used by the SMTP-server (default: none)
  • Username The username (default: none)
  • Password The password (default: none)

Methods

  • Send(Message, From, To, CC, BCC) Sends a message
  • Send(Message, From, To) Sends a message

Sample code in C#

// 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("administrator@localhost", "Your name");
// Defines the receiver
SMTP_Client.MailContact Receiver = new SMTP_Client.MailContact("someone@else", "Recipients name");
// 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("smtp.yourisp.com", 25));

// Sends the mail
Sender.Send(Message, From, Receiver);

Sample code in VB

' 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
Dim From As SMTP_Client.MailContact = New SMTP_Client.MailContact("administrator@localhost", "Your name")
' Defines the receiver
Dim Receiver As SMTP_Client.MailContact = New SMTP_Client.MailContact("someone@else", "Recipients name")
' Defines the mail message
Dim Message As SMTP_Client.MailMessage = New SMTP_Client.MailMessage("Small test result")
Message.Body = "This mail is sent by a Netduino :-)" + Constants.vbCrLf
Message.Body = Message.Body + "Good day!"

' Initializes the mail sender class
Dim Sender As SMTP_Client = New SMTP_Client(new IntegratedSocket("smtp.yourisp.com", 25))

' Sends the mail
Sender.Send(Message, From, Receiver)

Tip

If you are looking for an SMTP server that's available everywhere, http://www.gmx.com offers a free mail service with (authenticated) SMTP at port 25 and 587. So even if your ISP blocks port 25, you can always use port 587.

Last edited Jan 30, 2012 at 9:25 PM by Garrcomm, version 7