![]() |
|
|
#1 |
|
Dec 2011
After milion nines:)
5·172 Posts |
I would like to write small script that will check "results.txt" every 30 minutes and if found "!", mean PRP or prime is found to send me a mail.
Does some have to point me from where to start, or maybe have done script? Thanks! |
|
|
|
|
|
#2 |
|
"Mark"
Apr 2003
Between here and the
143138 Posts |
If you used PRPNet, it has the ability to send you and e-mail when a prime is found...
|
|
|
|
|
|
#3 |
|
If I May
"Chris Halsall"
Sep 2002
Barbados
37·263 Posts |
|
|
|
|
|
|
#4 |
|
Dec 2011
After milion nines:)
5·172 Posts |
|
|
|
|
|
|
#5 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
I have a small Python script which makes use of Python's builtin smtp module.
Code:
#! /usr/bin/env python3
host ='smtp.gmail.com'
port = 587
mode = 'tls'
acc = '<sthg>@gmail.com'
pw = ''
def email(*args): # HTML, attachments, cc?
'''(Subject, Message) or (Recipient, Subject, Message)'''
if len(args) == 2:
send_email(acc, acc, args[0], args[1], host, port, True, acc, pw)
elif len(args) == 3:
send_email(args[0], acc, args[1], args[2], host, port, True, acc, pw)
else:
raise ValueError("email() expects two or three arguments")
import smtplib
from email.utils import formatdate
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send_email(to, frm, sbjct, txt, host, port, tls=True, acct=None, pswd=None):
"""To, From, Subject, Body, Server, Port, Account, Password"""
msg = MIMEMultipart()
if isinstance(to, list):
to = ', '.join(to)
msg['To'] = to
msg['Subject'] = sbjct
msg['From'] = frm
msg['Date'] = formatdate(localtime=True)
msg.attach(MIMEText(txt))
server = smtplib.SMTP(host, port)
if tls:
server.starttls()
if acct or pswd:
server.login(acct, pswd)
server.send_message(msg)
if __name__ == '__main__':
from sys import argv
email(*argv[1:])
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Windows command line | mu5tan6 | Software | 14 | 2015-03-20 17:21 |
| Run Benchmark Test using Command Line Only? | Gabe Brown | Information & Answers | 3 | 2009-12-12 14:01 |
| command line switch | wongnog | Information & Answers | 1 | 2008-07-20 11:29 |
| NewPGen from the command line | monst | Software | 19 | 2008-01-31 07:07 |
| MultiSieve from the command line (on Windows) | monst | Software | 7 | 2007-12-18 02:37 |