Always keep in mind that you have the whole .NET framework available in Unity, especially in the editor.
This might also be helpful:
using System.Net;
using System.Net.Mail;
public void email_send()
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("your mail@gmail.com");
mail.To.Add("to_mail@gmail.com");
mail.Subject = "Test Mail - 1";
mail.Body = "mail with attachment";
System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment("c:/textfile.txt");
mail.Attachments.Add(attachment);
SmtpServer.Port = 587;
SmtpServer.Credentials =
new System.Net.NetworkCredential("ur mail@gmail.com", "ur password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
// consider, wrap MailMessage, SmtpClient with
// using to ensure disposed correctly
}
Might be some .Net classes that can do this, but I’d open a socket to your mail host on port 25, and talk smtp. This is a trivial text-based protocol for sending emails. The complication might be authentication. I use authsmtp.com for some emailing applications I have (so the code I use actually uses port 2525.)
graham$ telnet mail.authsmtp.com 2525
Trying 62.13.128.193...
Connected to mail.authsmtp.com.
Escape character is '^]'.
220 mail.authsmtp.com ESMTP Sendmail 8.14.2/8.14.2/; Wed, 12 Jun 2013 20:45:09 +0100 (BST)
EHLO localhost
250-mail.authsmtp.com Hello host [IP], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 52428800
250-AUTH CRAM-MD5 DIGEST-MD5 LOGIN PLAIN
250-STARTTLS
250 HELP
AUTH PLAIN {hashed password}
235 2.0.0 OK Authenticated
MAIL FROM:<sender email address>
250 2.1.0 <email address>... Sender ok
RCPT TO:<email address of receipient>
250 2.1.5 <email>... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Subject: Test
Content-Type: text/html; charset=ISO-8859-1
To: "The Boss" <email>
<h1>Hello</h1>
<p>world</p>
.
250 2.0.0 r5CJj9sp062618 Message accepted for delivery
QUIT
221 2.0.0 mail.authsmtp.com closing connection
Connection closed by foreign host.