Всем привет
Подскажите что я сделал не так
Всё ещё пытаюсь сделать форму для отправки на мыло
В данный момент мне приходит ошибка NullReferenceException: Object reference not set to an instance of an object
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Net;
using System.Net.Mail;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using UnityEngine.UI;
public class Send : MonoBehaviour
{
public InputField inputPhone;
public void send()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("Mymail");
mail.To.Add("Mymail");
mail.Subject = "Subject";
mail.Body = "Данные клиента:" + inputPhone.text;
SmtpClient smtpServer = new SmtpClient("
smtp.yandex.ru");
smtpServer.Port = 587;
smtpServer.Credentials = new System.Net.NetworkCredential("Mymail", "Password") as ICredentialsByHost;
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
smtpServer.Send(mail);
}
}