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

Send a message from the application

Discussion in 'Scripting' started by OkeyNik, May 8, 2019.

  1. OkeyNik

    OkeyNik

    Joined:
    Mar 14, 2017
    Posts:
    41
    Hello everyone, I want to implement the function, but I do not know how. So that the user can immediately write the message to my email address. You can call it bug report /feedback/case and so on. I also want to put my email address by default so that this line(a field which indicates "to whom" ) is not visible, but so that messages are sent to me.
    Here is my example: https://drive.google.com/open?id=1vpmc3vfcmX7uwozZVSCtXwpRUosh4DZq

    I have already implemented the function when a user clicks the "email" button in the main menu and a modal window appears. But then I do not know how to implement my idea.
     
  2. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    Use System.Net.Mail - it's not terribly efficient, but works.

    There's a recent thread here that Shows you how it can be done in principle.
     
  3. OkeyNik

    OkeyNik

    Joined:
    Mar 14, 2017
    Posts:
    41
    Thank you, but it says that the user must first use their username + password from the mail. And what if inside the application itself, using the code, enter my mail "testmail@test.com" and messages will be sent from this address to my developer mail (devtestmail@test.com)
     
  4. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    You do realize that if you want your app to send emails to you, you had better get the permission of the user, right? Otherwise you'll be reported as malware, and in the EU you'd be up for a hefty fine.

    So make sure that you have the user's permission to send mails from their machine. And you'll always send emails from their machine using your own email host - otherwise you could use the game to send tons of emails under the name of the user. So, set up an email host, then use your own mail server and password to send emails to you via the smtp protocol - that's what they are doing in the Unity thread. You can't use your user's email credentials to send you emails, as nobody in their right mind would allow you to do that.
     
  5. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Its better to create a backend service and let it send the email
     
  6. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,058
    Suggesting to write a script that contains a gmail user and password is bad. Anyone knowing how to decompile can track down the password and use it maliciously.

    Like @AndersMalmgren said, it is better to create a backend service for this. Doing a post request with the actual message data and let the backend send the e-mail is a lot safer.
     
  7. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    Agreed that any script that sends emails via https is a bad idea. But that was the OP's question.

    -ch