Mailto Text Tag

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
ErogamiDear
Newbie
Posts: 9
Joined: Sat Jun 30, 2018 7:58 am
Contact:

Mailto Text Tag

#1 Post by ErogamiDear »

There is a mailto tag in renpy? I'm thinking about using this feature to send anonymal data about game crashes and exceptions to my mail. (Notifying the player first, of course). Mmm... Maybe using the Python mail module or something. What do you think?

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Mailto Text Tag

#2 Post by xavimat »

I think it's a bad idea.
Thanks to your question, I've learned how to send emails inside renpy. It's pretty funny, actually. BUT I've put my gmail user and password in the code to do it. It's easy to unrpyc renpy files, so the password will be visible. Bad idea.

I suggest you another way, with web requests. See these threads:
viewtopic.php?f=8&t=49358&p=484662&hilit=mail#p484662
viewtopic.php?f=8&t=47568

I show here the insecure code, as an exercise, not intended for actual games that got distributed.
1. Added an Action SendMail
2. Added a button in the screen that shows the traceback.txt file.
3. Copied manually two python modules that renpy does not have: hmac.py and smtplib.py.

ATTENTION: Insecure code. Do not use in distributed games:

Code: Select all

label start:
    $ a = 3 / 0  # Division by zero error
    return

screen _exception_actions(traceback_fn, tt, *args):

    textbutton _("Open"):
        action _EditFile(traceback_fn)
        hovered tt.action(_("Opens the traceback.txt file in a text editor."))

    textbutton _("Copy"):
        action _CopyFile(traceback_fn)
        hovered tt.action(_("Copies the traceback.txt file to the clipboard."))

    textbutton _("Send"):
        action SendEmail(traceback_fn)
        hovered tt.action(_("Sends the traceback.txt file to the developer."))

init python:

    import smtplib

    class SendEmail(Action):
        def __init__(self, filename):
            self.filename = filename

        def __call__(self):

            with open(self.filename, "rb") as f:
                f.read(3) # skip the BOM.
                s = u"{}".format(f.read().decode("utf-8"))

            s = s.replace("\n", "\r\n")
            s = s.replace("\r\r", "\r")

            server = smtplib.SMTP('smtp.gmail.com', 587)
            server.starttls()

            # INSECURE CODE HERE!!!!:
            server.login("MYGMAILUSER", "MYGMAILPASSWORD")

            server.sendmail("MYGMAILUSER@gmail.com", "RECIPIENT@EMAIL.COM", s)
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Mailto Text Tag

#3 Post by PyTom »

I don't recommend this. Write a web service, and have that send email. If you can't do that, you have no business doing this.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Mailto Text Tag

#4 Post by PyTom »

PyTom wrote: Sun Jul 08, 2018 10:11 pm I don't recommend this. Write a web service, and have that send email. If you can't do that, you have no business accessing an SMTP server, with all the security and spam-protection limitations that entails.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

ErogamiDear
Newbie
Posts: 9
Joined: Sat Jun 30, 2018 7:58 am
Contact:

Re: Mailto Text Tag

#5 Post by ErogamiDear »

It hurts.

Post Reply

Who is online

Users browsing this forum: No registered users