SQL_PasswordRecovery.cs
using UnityEngine;
using System.Collections;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.Data;
using System;
using System.Net;
using System.Net.Mail;
using UnityEngine.Networking;
publicclassSQL_PasswordRecovery:MonoBehaviour
{
privatestaticMySqlCommandLinq=SQL_sqlConnect.Linq;
//NameSMTPserver(defaulforgmail’smtp.gmail.com’)
staticstringsmtpServer=“smtp.gmail.com”;
//PortSMTPserver(defaulforgmail’587’)
staticintport=587;
//SSLencodingSMTPserver(defaulforgmail’true’)
staticboolSSL=true;
//Namein mail
staticstringname=“MyServerpasswordrecovery”;
//Nameyourmail addres
staticstringFrom=“”;
//Passwordyour mail
staticstringpassword=“”;
//Mail theme
staticstringmailTheme=“PassworRecovery”;
//Mail message
staticstringmessage=“Pleasedonotforgetyourpassword:”;
staticMailMessagemail;
publicstaticvoidPasswordRecovery(NetworkMessagenetmsg)
{
stringlogin=netmsg.reader.ReadString();
Linq.CommandText=“SELECTPasswordAc,MailFROMAccountListWHEREAccountName='”+login+“';”;
MySqlDataReaderreader=Linq.ExecuteReader();
try{
reader.Read();
stringpass=message+reader.GetString(0);
stringmailto=reader.GetString(1);
ServicePointManager.ServerCertificateValidationCallback=delegate(objectsender, System.Security.Cryptography.X509Certificates.X509Certificatecertificate, System.Security.Cryptography.X509Certificates.X509Chainchain, System.Net.Security.SslPolicyErrorssslPolicyErrors){
returntrue;
};
MailAddress_From=newMailAddress(From,name);
MailAddress_mailto=newMailAddress(mailto);
mail=newMailMessage(_From,_mailto);
mail.Subject=mailTheme;
mail.Body=pass;
SmtpClientsmtp=newSmtpClient(smtpServer,port);
smtp.EnableSsl=SSL;
smtp.Credentials=(ICredentialsByHost)newNetworkCredential(From.Split(‘@’)[0],password);
smtp.DeliveryMethod=SmtpDeliveryMethod.Network;
stringcallback=“mail”;
smtp.SendCompleted+=CallBack;
smtp.SendAsync(mail,callback);
NetworkWriterwr=newNetworkWriter();
wr.StartMessage(Networking_msgType_Sr.PasswordRecovery);
wr.Write(“Passwordsenttoyouremail.”);
wr.FinishMessage();
netmsg.conn.SendWriter(wr,0);
mail.Dispose();
reader.Close();
}catch{
NetworkWriterwr=newNetworkWriter();
wr.StartMessage(Networking_msgType_Sr.PasswordRecovery);
wr.Write(“Loginnotfound.”);
wr.FinishMessage();
netmsg.conn.SendWriter(wr,0);
}
return;
}
publicstaticvoidCallBack(objectAsyncCallback, System.ComponentModel.AsyncCompletedEventArgse)
{
if(e.Cancelled){
Debug.Log(“Mailnotsent”);
}
if(e.Error !=null){
Debug.Log(e.Error.Message);
Debug.Log(e.Error.HelpLink);
}else{
Debug.Log(“Mailsent”);
}
}
}
if i click play, ERROR… anyone could help me?
Assets/ServerAndClient/Server/MySQL/SQL_PasswordRecovery.cs(8,18): error CS0234: The type or namespace name Mail' does not exist in the namespace
System.Net’. Are you missing an assembly reference?