omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. pietvo

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    pietvo

    @pietvo

    0
    Reputation
    521
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online
    Website pieter.vanoostrum.org Location Utrecht, NL

    pietvo Unfollow Follow

    Latest posts made by pietvo

    • RE: I cannot select a Pythonista script for the Today widget in iPadOs 15.1

      No, I didn’t know that. I thought selecting it in settings would be enough.
      So now I can select one of the examples. Thanks for the help.

      I have to modify my own script that I want to use. On previous systems I didn’t have to do that. The script doesn’t have a UI, but just prints something. That used to work but with the new version it doesn’t. But I guess I will find out by looking at the example widgets.

      posted in Pythonista
      pietvo
      pietvo
    • I cannot select a Pythonista script for the Today widget in iPadOs 15.1

      I bought a new iPad mini and it updated to 15,1. But I can’t set a script for the Pythonista widget. I select a script from Examples/Widgets, but after clicking Done it forgets it. When I click the widget it comes up again with the configuration screen and the selected script is no longer there.

      Is there something I can do, or us this a bug?

      posted in Pythonista
      pietvo
      pietvo
    • RE: How do you send an email

      Here is another simple example that I used myself, but anonamized. It works when the message text is ASCII.

      #!/usr/bin/env python3
      # Script to send an email. Runs with Python 3.6
      
      # Import smtplib for the actual sending function
      # Import the email modules we'll need
      import smtplib
      from email.message import EmailMessage
      
      ##### CONFIGURATION #####
      
      SMTP_SERVER = 'smtp.example.com'
      SMTP_PORT = 25
      SMTP_LOGIN = None # user name if needed
      SMTP_PASSWORD = 'secret'       # None if not needed
      
      #########################
      
      # Info for this message
      # Adressee
      name = 'adressee name'
      email = 'adressee@example.com'
      sender_name = 'Sender Name'
      sender_email = 'sender@example.com'
      subject = 'Test message'
      
      message = '''Dear {name},
      
      Thank you for your contribution to Python.
      
      With kind regards,
      {sender_name}
      {sender_email}
      '''
      #########################
      
      # build and send an email.
      # message = formatted message with optional {xxx} placeholders
      # for name, email, sender_name, sender_email.
      
      def send_email(message, from_name, from_email, to_name, to_email, subject):
      
          body = message.format(name=to_name, email=to_email,
                                sender_name=from_name, sender_email=from_email)
          msg = EmailMessage()
          msg.set_content(body)
          msg['Subject'] = subject
          msg['From'] = '"{name}" <{address}>'.format(name=from_name, address=from_email)
          msg['To'] = '{name} <{address}>'.format(name=to_name, address=to_email)
      
          # Send the message via the designated SMTP server.
          s = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
          # Login to the SMTP server if necessary
          if SMTP_LOGIN:
              s.login(SMTP_LOGIN, SMTP_PASSWORD)
          s.send_message(msg)
          s.quit()
      
      send_email(message, sender_name, sender_email, name, email, subject)
      print("Email sent to", name, "<"+email+">")
      
      posted in Pythonista
      pietvo
      pietvo