diff --git a/enigmail/.config b/enigmail/.config index b03fbdc..d69867e 100644 --- a/enigmail/.config +++ b/enigmail/.config @@ -1,3 +1,4 @@ -smtp_server = smtp.gmail.com -smtp_port = 587 -mail_address = test@mail.com +smtp_server = smtp1.iut-tlse3.fr +smtp_port = 465 +smtp_login = mrd1609a +mail_address = mrd1609a diff --git a/enigmail/bucket-file b/enigmail/bucket-file index 8b13789..e214881 100644 --- a/enigmail/bucket-file +++ b/enigmail/bucket-file @@ -1 +1,2 @@ - +coucou test :p +P \ No newline at end of file diff --git a/enigmail/enigmail.sh b/enigmail/enigmail.sh index 49b83f6..bb5f0f1 100644 --- a/enigmail/enigmail.sh +++ b/enigmail/enigmail.sh @@ -9,6 +9,7 @@ then # si 1 paramètre 'init') # initialise le contenu du fichier de config echo "smtp_server = smtp.gmail.com" > "$path/.config" echo "smtp_port = 587" >> "$path/.config" + echo "smtp_login = equal_mailadress_or_different_login" >> "$path/.config" echo "mail_address = test@mail.com" >> "$path/.config" ;; 'config') nano "$path/.config";; # ouvre en modification le fichier de config diff --git a/enigmail/source/enigmail.py b/enigmail/source/enigmail.py index e84f077..5a15621 100644 --- a/enigmail/source/enigmail.py +++ b/enigmail/source/enigmail.py @@ -20,7 +20,7 @@ def getConf(pPath): confVal = i[i.index('=')+1:].replace(' ', '').replace('\n', ''); conf[confKey] = confVal; - if( len(conf) == 3 ): # si le fichier de config est bien récupéré et qu'il est complet + if( len(conf) == 4 ): # si le fichier de config est bien récupéré et qu'il est complet return conf; else: return False; @@ -29,6 +29,7 @@ def getConf(pPath): # cette fonction envoie un mail def sendMail(pConf, pPass, pTo, pSubject, pMessage): + srv = smtplib.SMTP(pConf['smtp_server'], int(pConf['smtp_port']) ); try: pMsg = MIMEMultipart(); pMsg['From'] = pConf['mail_address']; @@ -37,19 +38,20 @@ def sendMail(pConf, pPass, pTo, pSubject, pMessage): pMsg.attach( MIMEText(pMessage.encode('utf-8')) ); - srv = smtplib.SMTP(pConf['smtp_server'], pConf['smtp_port']); srv.ehlo(); - srv.starttls(); - srv.ehlo(); - srv.login(pConf['mail_address'], pPass); + if( srv.has_extn('STARTTLS') ): + srv.starttls(); + srv.ehlo(); + + srv.login(pConf['smtp_login'], pPass); srv.sendmail( pConf['mail_address'], pTo, pMsg.as_string() ); - srv.quit(); - + print "> Mail envoye !"; except smtplib.SMTPAuthenticationError: print "> Mauvais login ou mot de passe\n\(enigmail config) pour changer votre adresse"; - + finally: + srv.quit(); diff --git a/enigmail/source/enigmail.pyc b/enigmail/source/enigmail.pyc new file mode 100644 index 0000000..c8efda9 Binary files /dev/null and b/enigmail/source/enigmail.pyc differ