MCPcopy Index your code
hub / github.com/diffgram/diffgram / send

Method send

shared/communicate/email.py:27–46  ·  view source on GitHub ↗
(self, email: str, subject: str, message: str, email_list: list = [])

Source from the content-addressed store, hash-verified

25 self.from_email = settings.SMTP_FROM_EMAIL
26
27 def send(self, email: str, subject: str, message: str, email_list: list = []):
28 is_set_smtp_mailer = mail_var_is_set(settings.EMAIL_VALIDATION) and mail_var_is_set(settings.SMTP_HOST) \
29 and mail_var_is_set(settings.SMTP_PORT) and mail_var_is_set(settings.SMTP_USERNAME) and \
30 mail_var_is_set(settings.SMTP_PASSWORD)
31 if not is_set_smtp_mailer:
32 return
33 recipients = email_list
34 if len(email_list) == 0:
35 recipients = [email]
36 s = smtplib.SMTP_SSL(self.smtp_host, self.smtp_port)
37 s.ehlo()
38 for to_email in recipients:
39 msg = MIMEText(message)
40 msg['Subject'] = subject
41 msg['From'] = formataddr(('Diffgram', f"{self.from_email}"))
42 msg['To'] = to_email
43
44 s.login(self.smtp_username, self.smtp_pass)
45 s.sendmail(msg['From'], msg['To'], msg.as_string())
46 s.quit()
47
48 def send_legacy(self, email, subject, message, email_list = [], html = None):
49 data = {"from": f"Diffgram <web@{self.domain_name}>",

Callers 14

send_magic_login_emailFunction · 0.80
start_verify_via_emailFunction · 0.80
project_update_coreFunction · 0.80
email_about_new_pro_jobFunction · 0.80
notify_user_passed_examFunction · 0.80
email_linkMethod · 0.80
email_existing_userMethod · 0.80
invite_userMethod · 0.80
new_plan_apiFunction · 0.80
commands.jsFile · 0.80
update_instance_listMethod · 0.80

Calls 1

mail_var_is_setFunction · 0.70

Tested by

no test coverage detected