- Home /
How to send text in a json file in mail.body?
his is the script I use for sending an Email:
using System.IO; using System.Text; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.Networking; using System.Net; using System.Net.Mail; using System.Net.Security; using System.Security.Cryptography.X509Certificates;
public void SendEmail() { MailMessage mail = new MailMessage();
mail.From = new MailAddress("sender@gmail.com");
mail.To.Add("reciever1@gmail.com");
mail.To.Add("reciever2@gmail.com");
mail.To.Add("reciever3@gmail.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL"; //MAIL BODY
SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
smtpServer.Port = 587;
smtpServer.Credentials = new System.Net.NetworkCredential("sender@gmail.com", "senderpassword") as ICredentialsByHost;
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
smtpServer.Send(mail);
Debug.Log("success");
}
I am building a survey sytem. I store all my "Answers" in a json file. I want to take all the "Answers" stored in the json file and add it to the mail.body . is there a way possible to do this?
Your answer
Follow this Question
Related Questions
How to send an Email with the details entered in a json file? 0 Answers
JSON in Unity JavaScript 1 Answer
JSON Parser for IOS Billing receipts 0 Answers
deserialization JSON to C# 0 Answers
using json file for waypoints for vehicle in unity project. 0 Answers