Hello. I am fairly new to this and I am trying to send an email with the FEZ Cobra II and I am having a bit of trouble. I have found several forums online about it but they seemed incomplete, in that they couldnt help me get this working. Here is the code I am using now:
using System;
using Microsoft.SPOT;
using Toolbox.NETMF.NET;
using Toolbox.NETMF;
using System.Threading;
using Microsoft.SPOT.Net;
using Microsoft.SPOT.Net.NetworkInformation;
namespace MFConsoleApplication1
{
public class Program
{
public static void Main()
{
Debug.Print("working");
// Defines the sender
SMTP_Client.MailContact From = new SMTP_Client.MailContact("testercode@ gmail.com", "herron");
// Defines the receiver
SMTP_Client.MailContact Receiver = new SMTP_Client.MailContact("testercode@ gmail.com", "receiver");
// 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
//string smtp = "smtp.gmail.com";
string smtp = "server: aspmx.l.google.com" /*smtp.gmail.com tried this too*/ ;
string username = "testcode";
string pass = "Testercode7";
SMTP_Client.AuthenticationTypes authtype = SMTP_Client.AuthenticationTypes.None;
SMTP_Client Sender = new SMTP_Client(new IntegratedSocket(smtp, 25 /*465*/), authtype, username, pass);
{
//not sure what this host stuff is doing
// 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
Hostname = Hostname.Substring(0, LastDot);
//JJ start
}
Sender.Send(Message, From, Receiver)