Delete modules/email.py
Browse files- modules/email.py +0 -52
modules/email.py
DELETED
|
@@ -1,52 +0,0 @@
|
|
| 1 |
-
import smtplib
|
| 2 |
-
from email.mime.text import MIMEText
|
| 3 |
-
from email.mime.multipart import MIMEMultipart
|
| 4 |
-
import os
|
| 5 |
-
|
| 6 |
-
def send_email_notification(name, email, institution, role, reason):
|
| 7 |
-
sender_email = "noreply@aideatext.ai" # Configura esto con tu direcci贸n de correo
|
| 8 |
-
receiver_email = "hello@aideatext.ai"
|
| 9 |
-
password = os.environ.get("EMAIL_PASSWORD") # Configura esto en tus variables de entorno
|
| 10 |
-
|
| 11 |
-
message = MIMEMultipart("alternative")
|
| 12 |
-
message["Subject"] = "Nueva solicitud de prueba de AIdeaText"
|
| 13 |
-
message["From"] = sender_email
|
| 14 |
-
message["To"] = receiver_email
|
| 15 |
-
|
| 16 |
-
text = f"""\
|
| 17 |
-
Nueva solicitud de prueba de AIdeaText:
|
| 18 |
-
Nombre: {name}
|
| 19 |
-
Email: {email}
|
| 20 |
-
Instituci贸n: {institution}
|
| 21 |
-
Rol: {role}
|
| 22 |
-
Raz贸n: {reason}
|
| 23 |
-
"""
|
| 24 |
-
|
| 25 |
-
html = f"""\
|
| 26 |
-
<html>
|
| 27 |
-
<body>
|
| 28 |
-
<h2>Nueva solicitud de prueba de AIdeaText</h2>
|
| 29 |
-
<p><strong>Nombre:</strong> {name}</p>
|
| 30 |
-
<p><strong>Email:</strong> {email}</p>
|
| 31 |
-
<p><strong>Instituci贸n:</strong> {institution}</p>
|
| 32 |
-
<p><strong>Rol:</strong> {role}</p>
|
| 33 |
-
<p><strong>Raz贸n:</strong> {reason}</p>
|
| 34 |
-
</body>
|
| 35 |
-
</html>
|
| 36 |
-
"""
|
| 37 |
-
|
| 38 |
-
part1 = MIMEText(text, "plain")
|
| 39 |
-
part2 = MIMEText(html, "html")
|
| 40 |
-
|
| 41 |
-
message.attach(part1)
|
| 42 |
-
message.attach(part2)
|
| 43 |
-
|
| 44 |
-
try:
|
| 45 |
-
with smtplib.SMTP_SSL("smtp.gmail.com", 465) as server:
|
| 46 |
-
server.login(sender_email, password)
|
| 47 |
-
server.sendmail(sender_email, receiver_email, message.as_string())
|
| 48 |
-
logger.info(f"Email notification sent for application request: {email}")
|
| 49 |
-
return True
|
| 50 |
-
except Exception as e:
|
| 51 |
-
logger.error(f"Error sending email notification: {str(e)}")
|
| 52 |
-
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|