Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Jesus_Freak · Feb 28, 2011 at 12:26 AM · email

Simple Email Script

hello, community, after some experiments with GUI.TextAreas and GUI.PasswordFields, i've been inspired to make an email form with unity (to send an automatic email to the person by the game itself.)

so the user will enter 3 inputs: email, username, and password.

I plan on having the game send an email (with my email address) with the player's info to their email address.

i've seen some posts on here about smtp stuff. could someone who knows what they're talking about (even a little bit) please explain to me what smtp is, how to use it, and what it does?

or if you could send me a link to a tutorial on scripting involving smtp or email scripting.

(i'm going to do some youtube researching myself, but any help IS appreciated!!!!)

thank you!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jesus_Freak · Feb 28, 2011 at 12:56 AM 0
Share

nothing on youtube i can find on this...

avatar image Jesus_Freak · Feb 28, 2011 at 01:50 AM 0
Share

I would post the script i have so far, but all it does is make 2 TextAreas and 1 PasswordField and collect that information to PlayerPrefs.

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Keavon · Feb 28, 2011 at 01:33 AM

I would recommend you use PHP, and send a request for a separate PHP page that takes the info in the URL, and then sends it. This is the script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Email Test</title> </head> <body>

<?php

$address = $_GET['address']; $username = $_GET['username']; $password = $_GET['password'];

$content = "Welcome to my game, and thanks for signing up!\nYour login details is as follows:\nUsername: $username \nPassword: $password";

$to = "$address"; $subject = "Thanks for signing up for my game!"; $body = "$content"; $from = "what-ever-email-address-you-want@what-ever-domain-you-want.com"; $headers = "From: $from";

if (mail($to, $subject, $body, $headers)) { echo("<p>Email Sent!</p>"); } else { echo("<p>Email Failed to Send.</p>"); } ?>

</body> </html>

Basically make a new .txt file, open it in WordPad or NotePad, copy that in, edit the message to how you like it (keep in the things with $'s). Edit the email address to select who it's from (note it will always be from your web host, but that is what the users see. It's masked). Then save the file, close your text editing tool, rename the file send_message.php, then upload it to your host (make sure your host is running PHP on their servers).

You want your game to call this url: http://www.example.com/send_message.php?address=user-email@their-host.com&username=user-input-username&password=the-user-input-password

Note you may not want to include their password. You can also star it out, if you want. I hope that helps!

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Keavon · Feb 28, 2011 at 02:37 AM 0
Share

Hehe, and you thought you were young making these things and answering people's questions. 'Bet you didn't think someone even younger than YOU would answer YOUR question. :D Cheers.

avatar image Jesus_Freak · Feb 28, 2011 at 02:40 AM 0
Share

Thank you!!! I'll try it out soon. I know how to do some basic HT$$anonymous$$L and JavaScript coding, but not php. But I'm learning from a tutorial (but you really helped me on my way). And answered my question perfectly 100%.

avatar image Keavon · Feb 28, 2011 at 05:21 AM 0
Share

Great! I'm glad I could help! PHP is SO EASY. It's much easier than even JavaScript. :D

avatar image Jesus_Freak · Feb 28, 2011 at 07:58 PM 0
Share

wait, so where you said "http://www.example.com/send_message.php?address=user-email@their-host.com&username=user-input-username&password=the-user-input-password " the ww.example.com is my host website?

avatar image Jesus_Freak · Feb 28, 2011 at 08:02 PM 0
Share

if so, then perfect! i sorta, kinda get your script. I have an idea of what it's doing. but the syntax and all that,m i'm still learning, anyway, THAN$$anonymous$$ YOU!!!!!

Show more comments
avatar image
0

Answer by Eric5h5 · Feb 28, 2011 at 01:27 AM

This isn't anything you'd do in Unity. You send the data to a web app of some kind (write in in PHP, perl, whatever, but it's off-topic here), which does the actual processing and emailing.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

How to send a e-mail via smtp 0 Answers

Can't access to gmail using the build 1 Answer

Can the webplayer send emails? 0 Answers

Send an email from unity to email adress? 1 Answer

Serialize data to XML File, then send via email as attachment on iOS. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges