In the game I capture a screenshot and I’d like to send it via mail.
Is it possible to send it wihtout saving the file to the hard drive?
I tried
mail.Attachments.Add(screenshotFile);
But I need to change the byte to attachment. Is it possible to do that?
(I’m using gmail as smtp).
My code is the following:
static public void GmailSend (string mail, string subject, string body)
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("email@email.here");
mail.To.Add(mail);
mail.Subject = subject;
mail.Body = body;
**//add a byte[] attachment to the Mail here**
SmtpClient smtpServer = new SmtpClient(senderSmtp);
smtpServer.Port = senderPort;
smtpServer.Credentials = new System.Net.NetworkCredential(senderEmail, senderPassword) as ICredentialsByHost;
if (sslEnabled){
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
}
smtpServer.Send(mail);
Debug.Log("success");
}