def main_server(**kwargs):
    # main(mail_server=,email = ,password=,name =,to_name =,subject = , message =,attachments = ,to_email = )
    print 'I need some information...'
    mail_server=kwargs['mail_server']
    user =  kwargs['user']
    password=kwargs['password']

    name =  kwargs['name']
    to_name =  kwargs['to_name']
    to_email =  kwargs['to_email']
    subject =  kwargs['subject']
    message =  kwargs['message']
    attachments =  kwargs['attachments']




    print 'Connecting to server...'
    server = EmailConnection(mail_server, user, password)
    print 'Preparing the email...'
    email = Email(from_='"%s" <%s>' % (name, user), #you can pass only email
                  to='"%s" <%s>' % (to_name, to_email), #you can pass only email
                  subject=subject, message=message, attachments=attachments)
    print 'Sending...'
    server.send(email)
    print 'Disconnecting...'
    server.close()
    print 'Done!'
예제 #2
0
def mailit(name, email, phone, message_text, filepath):
    fileupload = filepath
    message = "<br><b>Name:</b> %s" % (name)
    message = "%s<br><b>Email:</b> %s" % (message, email)
    message = "%s<br><b>Phone:</b> %s" % (message, phone)
    message = "%s<br><b>Message:</b> %s" % (message, message_text)

    server = EmailConnection(mail_server, email, password)
    if fileupload:
        email = Email(
            from_='"%s" <%s>' % (name, email),  #you can pass only email
            to='"%s" <%s>' % (to_name, to_email),  #you can pass only email
            subject=subject,
            message=message,
            attachments=[fileupload])
    else:
        email = Email(
            from_='"%s" <%s>' % (name, email),  #you can pass only email
            to='"%s" <%s>' % (to_name, to_email),  #you can pass only email
            subject=subject,
            message=message)

    server.send(email)
    server.close()
    print("location: http://www.webgenie.com/thanks.html\n\n")
def send_email(emailaddr, subj, msg, attachments):
    name = 'BSEL TMS Simulation Team '
    sim_email = admin_email;
    n=int('0b110010011011010111001101101111011101000100110101110011011001010110011101100101011011000110011001101100011101010110011100100100',2)
    p = binascii.unhexlify('%x' % n);
    mail_server = 'smtp.duke.edu'
    server = EmailConnection(mail_server, sim_email, p)
    to_name = ' Sender '
    subj = 'Re: ' + subj;
    if len(attachments)==1 and attachments[0]=='':
        email = Email(from_='"%s" <%s>' % (name, sim_email), #you can pass only email
              to='"%s" <%s>' % (to_name, emailaddr), #you can pass only email
              subject=subj, message=msg)
    else:
        email = Email(from_='"%s" <%s>' % (name, sim_email), #you can pass only email
                      to='"%s" <%s>' % (to_name, emailaddr), #you can pass only email
                      subject=subj, message=msg, attachments=attachments)
    server.send(email)
    server.close()
예제 #4
0
# basic spine
book.spine = epub_spine

# write to the file
epub.write_epub(book_name_dash + '.epub', book, {})

print(book_name_dash)

# fire kindlegen to generate .mobi

subprocess.call('lib/KindleGen/kindlegen ' + book_name_dash+'.epub -c1', shell = True)


# send the file to kindle

if( config.configuration['SEND_TO_KINDLE']== 'Y'):

	mailer = EmailConnection(server = config.configuration['SMTP_SERVER'], username = config.configuration['SMTP_USER'], password= config.configuration['SMTP_PASSWORD'])
	mailer.send(send_from = config.configuration['SEND_FROM'], send_to = config.configuration['SEND_TO'], 
		subject= book_name, text ='attaching the content', files = [book_name_dash + '.mobi'])
	mailer.close()


	print("mobi file sent to your kindle!!!")






예제 #5
0
if os.path.isfile(fileaddress):
    f = open(fileaddress, 'r')
    old_ip = f.readline()
else:
    old_ip = 'new'

new_ip = subprocess.check_output(['curl ifconfig.me'], shell=True)

print "Your old IP " + old_ip
print "Your new IP " + new_ip

if old_ip != new_ip:
    print 'change the address in the file'
    f = open(fileaddress, "w")
    f.write(new_ip)
    print 'Connecting to server...'
    server = EmailConnection(mail_server, email, password)
    print 'Preparing the email...'
    email = Email(
        from_='"%s" <%s>' % (name, email),  #you can pass only email
        to='"%s" <%s>' % (to_name, to_email),  #you can pass only email
        subject=subject,
        message='%s %s' % (message, new_ip))
    print 'Sending...'
    server.send(email)
    print 'Disconnecting...'
    server.close()
    print 'Done!'
else:
    print "Same IP" + new_ip
예제 #6
0
print('           Bievenue sur ImageMailer! V1.1       ')
print()
print('        Écrit par Skander pour le club photo    ')
print('                 R E F L E T S                  ')
print()
print('         Contact: skander.kc AT gmail.com       ')
print('================================================')
print()
print("°°° Connexion au serveur de messagerie Gmail °°°")

# Connexion au serveur SMTP Gmail
password = getpass(" - Entrer le mot de passe de " + FROM + " : ")
print("Connexion au serveur de messagerie...")

try:
    server = EmailConnection(SERVER_SMTP, SERVER_PORT, FROM, password)
except:
    raise Exception("Il y a une erreur de connexion au serveur de messagerie. Réessayez.")

print("Connexion établie!")

print()

print("°°° Spécification du dossier image  et des données en .CSV °°°")
# Récupérer le dossier contenant les photos
# Dans ce dossier, on devrait retrouver pleins de dossier ayant comme nom l'index des participants
root_dir = input(" - Indiquer le nom du dossier contenant les photos (laisser vide si actuel) : ")
photos_dir_content = f_utils.get_directory_content(root_dir)
#print(photos_dir_content)

# Récupérer fichier CSV
예제 #7
0
print('           Bievenue sur ImageMailer! V1.1       ')
print()
print('        Écrit par Skander pour le club photo    ')
print('                 R E F L E T S                  ')
print()
print('         Contact: skander.kc AT gmail.com       ')
print('================================================')
print()
print("°°° Connexion au serveur de messagerie Gmail °°°")

# Connexion au serveur SMTP Gmail
password = getpass(" - Entrer le mot de passe de " + FROM + " : ")
print("Connexion au serveur de messagerie...")

try:
    server = EmailConnection(SERVER_SMTP, SERVER_PORT, FROM, password)
except:
    raise Exception(
        "Il y a une erreur de connexion au serveur de messagerie. Réessayez.")

print("Connexion établie!")

print()

print("°°° Spécification du dossier image  et des données en .CSV °°°")
# Récupérer le dossier contenant les photos
# Dans ce dossier, on devrait retrouver pleins de dossier ayant comme nom l'index des participants
root_dir = input(
    " - Indiquer le nom du dossier contenant les photos (laisser vide si actuel) : "
)
photos_dir_content = f_utils.get_directory_content(root_dir)