示例#1
0
def send_email(file_name):
    print "zend email"
    fromaddr = '*****@*****.**'
    password = '******'
    toaddrs = ['*****@*****.**']

    mail = Email()
    mail.send(file_name,fromaddr,password,toaddrs)
示例#2
0
 def send_email(self, subject, content, html=True, files=()):
     if self._send_email and self._email_recipients:
         self.log.debug('Send email to {}'.format(self._email_recipients))
         em = Email(self._conf['email']['server'],
                    self._conf['email']['sender'],
                    self._email_recipients)
         em.send(subject, content, html, files=files)
     else:
         self.log.warning("Won't send email (send_email: %s, recipients: %s)",
                          self._send_email, self._email_recipients)
 def send_email(self, subject, content, html=True, files=()):
     if self._send_email and self._email_recipients:
         self.log.debug('Send email to {}'.format(self._email_recipients))
         em = Email(self._conf['email']['server'],
                    self._conf['email']['sender'],
                    self._email_recipients)
         em.send(subject, content, html, files=files)
     else:
         self.log.warning("Won't send email (send_email: %s, recipients: %s)",
                          self._send_email, self._email_recipients)
示例#4
0
def main():
    """
    Entry-point for the function.
    """

    email_connection_params = {
        "host": "smtp.gmail.com",
        "port": 587,
        "user": "******",
        "password": "******",
        "use_tls": True
    }
    send_email = Email(**email_connection_params)
    send_email.send(to_address=['*****@*****.**'])
示例#5
0
文件: main.py 项目: cyrusn/picroscope
def send_image():
    filename = picroscope.capture()
    if filename is not None:
        picroscope.toggle_preview()

        email = Email(server)
        email.subject = EMAIL_SUBJECT
        email.recipient = input("Recipient: ")
        email.add_attachment(filename)

        print()
        try:
            print("Please wait ...")
            email.send()
        except SMTPRecipientsRefused:
            print("Invalid email address.")
示例#6
0
username = config.get('MOVIES', 'MYSQL_USER')
password = config.get('MOVIES', 'MYSQL_PASSWORD')

##-----------------------------------------------------------------------------
##-----------------------------------------------------------------------------
conn = Connection(username, password)
conn.connect()
conn.create_table()

print("Enter Number of Users you want to Register", end=" ")
n = int(input())
for i in range(n):
    x = input("Email address:")
    tv = input("TV series:")
    insert = True
    for ser in conn.select_value(x):
        if ser[0] == tv:
            insert = False
    if insert:
        conn.insert_value(x.lower(), tv.lower())
    else:
        print("Database already has your information")

email = Email()
grab = grabber()
for x in conn.select_all():
    recv, series = x[0], x[1]
    email.send(recv, grab.information(series))

conn.close_connection()
示例#7
0
if __name__ == '__main__':

    duration = 3  # seconds
    freq = 440  # Hz

    email_server = Email()
    last_email = None
    sleep_interval = 60

    while True:

        time.sleep(sleep_interval)

        time_slots = download_page(month=2)
        time_slots += download_page(month=3)
        time_slots += download_page(month=4)

        if len(time_slots) == 0:
            continue
        else:
            print(datetime.now(), time_slots)

        content = str(time_slots)
        if last_email and content == last_email:
            continue
        
        os.system(f'play -nq -t alsa synth {duration} sine {freq}')

        email_server.send('Eldora parking', content)
        last_email = content
示例#8
0
    if parameters['pressent'] == 0 and not skip:
        print "None: ", parameters['name'], "NO EMAIL"
        #text_tmp = text_zero % parameters

    if parameters['pressent'] == 1 and not skip:
        #text_tmp = text_one % parameters
        print "One pressent: ", parameters['name'], "NO EMAIL"

    if parameters['pressent'] == 2 and not skip:
        text_tmp = text_missing_one % parameters
        #print "Two pressent: ", parameters['name']

    if parameters['pressent'] >= 3 and not skip:
        text_tmp = text_passed % parameters
        #print "Three or more: ", parameters['name']

    if parameters['pressent'] in [2, 3, 4] and not skip:
        #print parameters['name']
        text_tmp = email.rst_to_html(text_tmp).encode('utf-8')
        msg = MIMEMultipart()
        msg['Subject'] = 'Mandatory group sessions'
        msg['To'] = parameters['email']
        msg['From'] = smtp.email
        body_text = MIMEText(text_tmp, 'html', 'utf-8')
        msg.attach(body_text)
        email.send(msg, parameters['email'])

    skip = False

email.logout()
示例#9
0
    if parameters['pressent'] == 0 and not skip:
        print "None: ", parameters['name'], "NO EMAIL"
        #text_tmp = text_zero % parameters

    if parameters['pressent'] == 1 and not skip:
        #text_tmp = text_one % parameters
        print "One pressent: ", parameters['name'], "NO EMAIL"

    if parameters['pressent'] == 2 and not skip:
        text_tmp = text_missing_one % parameters
        #print "Two pressent: ", parameters['name']

    if parameters['pressent'] >= 3 and not skip:
        text_tmp = text_passed % parameters
        #print "Three or more: ", parameters['name']

    if parameters['pressent'] in [2, 3, 4] and not skip:
        #print parameters['name']
        text_tmp = email.rst_to_html(text_tmp).encode('utf-8')
        msg = MIMEMultipart()
        msg['Subject'] = 'Mandatory group sessions'
        msg['To'] = parameters['email']
        msg['From'] = smtp.email
        body_text = MIMEText(text_tmp, 'html', 'utf-8')
        msg.attach(body_text)
        email.send(msg, parameters['email'])

    skip = False

email.logout()