Last active
January 6, 2018 23:12
-
-
Save aseques/8aa8a0408a9b9e0599c1aa0235d1b028 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| email: | |
| host: server.example.com:465 | |
| user: user@example.com | |
| pass: pass | |
| desti: desti@example.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import yaml | |
| from mailshake import SMTPMailer, EmailMessage | |
| with open('config.yml', 'r') as ymlfile: | |
| config = yaml.load(ymlfile) | |
| mailer = SMTPMailer(host=config['email']['host'], port=25, username=config['email']['user'], password=config['email']['pass'], | |
| use_tls=None, use_ssl=None, timeout=5, max_recipients=200) | |
| with open ('fitxer.txt', "r") as myfile: | |
| txt_body = myfile.read() | |
| email_msg = EmailMessage( | |
| 'Hi', | |
| 'Hello world!', | |
| config['email']['user'], | |
| [config['email']['desti']] | |
| ) | |
| email_msg.attach('nomfiter.txt',txt_body) | |
| mailer.send_messages(email_msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment