Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

lil question, HELP UNET 'Server + MySQL and Clients' Asset

Discussion in 'UNet' started by voltaire2016, May 11, 2016.

  1. voltaire2016

    voltaire2016

    Joined:
    May 11, 2016
    Posts:
    7
    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?
     
  2. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,115
    Which platform is your project set to? System.Net is only accessible in PC/Mac builds.
     
  3. voltaire2016

    voltaire2016

    Joined:
    May 11, 2016
    Posts:
    7
    I'm not sure... how to check and set it up?
     
  4. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,115
  5. voltaire2016

    voltaire2016

    Joined:
    May 11, 2016
    Posts:
    7
    1.jpg
    why it said no PC, Mac & Linux Standalone Module Loaded?.... when i click open download page, it said...

    Not Found
    This page is no longer available. You might find what you are looking for by browsing through the links in our top menu or, trying one of the links below.

    2.jpg
    is this asset only for web player?
     
  6. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,115
    You'll have to reinstall Unity with "Windows Build Support" checked at the Choose Components screen. Right now it seems like you don't have it installed.

     
  7. voltaire2016

    voltaire2016

    Joined:
    May 11, 2016
    Posts:
    7
    im sorry my mistakes, UnitySetup-Windows-Support-for-Editor-5.3.4f1 should be install first, thanks for the answer jhony 10 :p