<div dir="ltr">Hi, <div><br></div><div>I sent my task two over two days ago and didn't receive the task 03.</div><div>I already sent 6 times the task 02 answer, but I got nothing instead. </div><div>I used mutt, and a python script.</div>
<div>The first time that I sent was two days ago. </div><div><br></div><div>Has Eudyptula Challenge died ? </div><div>Is down for a few days ?</div><div><br></div><div><br></div><div>Thanks a Lot. </div><div><div><br class="">
--</div>Lucas Tanure <br></div><div><br></div><div><br></div><div>The Python script</div><div><br></div><div><div>tanure@archNote email $ cat sender.py </div><div>#!/usr/bin/python3</div><div>from smtplib import SMTP</div>
<div>from itertools import chain</div><div>from errno import ECONNREFUSED</div><div>from mimetypes import guess_type</div><div>from subprocess import Popen, PIPE</div><div>from email.mime.base import MIMEBase</div><div>from email.mime.text import MIMEText</div>
<div>from socket import error as SocketError</div><div>from email.mime.multipart import MIMEMultipart</div><div>from os.path import abspath, basename, expanduser</div><div>import getpass</div><div><br></div><div># Define ID</div>
<div>id_eudyptula = '[404ba4c8fd16]'</div><div><br></div><div># Define email addresses to use</div><div>addr_to = '<a href="mailto:little@eudyptula-challenge.org">little@eudyptula-challenge.org</a>'</div>
<div>addr_from = '<a href="mailto:tanure@linux.com">tanure@linux.com</a>'</div><div><br></div><div># Define SMTP email server details</div><div>smtp_server = SMTP("<a href="http://smtp.gmail.com">smtp.gmail.com</a>",587)</div>
<div>smtp_user = '<a href="mailto:ltanure@gmail.com">ltanure@gmail.com</a>'</div><div>smtp_pass = getpass.getpass()</div><div><br></div><div><br></div><div>def get_mimetype(filename):</div><div> content_type, encoding = guess_type(filename)</div>
<div> if content_type is None or encoding is not None:</div><div> content_type = "application/octet-stream"</div><div> return content_type.split("/", 1)</div><div><br></div><div><br></div>
<div>def mimify_file(filename):</div><div> filename = abspath(expanduser(filename))</div><div> basefilename = basename(filename)</div><div><br></div><div> msg = MIMEBase(*get_mimetype(filename))</div><div> msg.set_payload(open(filename, "r").read())</div>
<div> msg.add_header("Content-Disposition", "attachment", filename=basefilename)</div><div> #encode_base64(msg)</div><div> return msg</div><div><br></div><div><br></div><div>def send_email(subject, text, files):</div>
<div> # Prepare Message</div><div> msg = MIMEMultipart()</div><div> msg.preamble = subject</div><div> msg.add_header("From", addr_from)</div><div> msg.add_header("Subject", id_eudyptula + ' ' + subject)</div>
<div> msg.add_header("To",addr_to)</div><div><br></div><div> # Attach the main text</div><div> msg.attach(MIMEText(text))</div><div><br></div><div> # Attach any files</div><div> [msg.attach(mimify_file(filename)) for filename in files]</div>
<div><br></div><div> # Contact local SMTP server and send Message</div><div> try:</div><div> smtp_server.ehlo()</div><div> smtp_server.starttls()</div><div> smtp_server.ehlo()</div><div> smtp_server.login(smtp_user, smtp_pass)</div>
<div> smtp_server.sendmail(addr_from, addr_to, msg.as_string())</div><div> smtp_server.quit()</div><div> except SocketError as e:</div><div> print(e)</div><div><br></div><div><br></div><div>if __name__ == "__main__":</div>
<div> text = open('text','r').read()</div><div> send_email("Task 02 of the Eudyptula Challenge",text,['.config','dmesg'])</div></div><div><br></div><div><div><div dir="ltr">
<br><br></div></div>
</div></div>