- Home /
Question by
AevinGames · Apr 07, 2017 at 11:22 PM ·
c#shadermail
CS0433, No PUN. Unity 5.4. C#.
Title basically gives all details.
Error Codes: Assets/Scripts/GmailScript.cs(59,17): error CS0433: The imported type `System.Net.Mail.SmtpClient' is defined multiple times
Script:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System;
using System.Net;
using System.Net.Mail;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public class GmailScript : MonoBehaviour {
public Text User_nameT;
public string User_name;
public Text User_MessageT;
public string User_Message;
public float coolDown = 60;
public float Timer;
public Text SubmitText;
void Update()
{
if (Timer > 0)
{
Timer -= Time.deltaTime;
SubmitText.text = Mathf.Round(Timer).ToString();
}
if (Timer < 0)
{
Timer = 0;
SubmitText.text = "SUBMIT";
}
if (Timer == 0)
{
SubmitText.text = "SUBMIT";
}
}
public void Send()
{
User_Message = User_MessageT.text;
User_name = User_nameT.text;
if (MenuUIMan.TogVal == 0)
{
if (Timer == 0)
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("Receiver@gmail.com");
mail.To.Add("Sender@gmail.com");
mail.Subject = "BugReport_GivenFromComBot";
mail.Body = "User:" + User_name + " " + "Message:" + User_Message;
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");
Timer = coolDown;
}
}
if (MenuUIMan.TogVal == 1)
{
if (Timer == 0)
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("Receiver@gmail.com");
mail.To.Add("Sender@gmail.com");
mail.Subject = "Suggestion_GivenFromComBot";
mail.Body = "User:" + User_name + " " + "Message:" + User_Message;
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");
Timer = coolDown;
}
}
}
}
Comment
Your answer

Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to create light like in minecraft? 1 Answer
Is it possible to modify a material/shader in code? 1 Answer