MCPcopy Index your code
hub / github.com/webpy/webpy / default_email_sender

Method default_email_sender

web/utils.py:1586–1604  ·  view source on GitHub ↗
(self, message_text)

Source from the content-addressed store, hash-verified

1584 smtpserver.quit()
1585
1586 def default_email_sender(self, message_text):
1587 try:
1588 from . import webapi
1589 except ImportError:
1590 webapi = Storage(config=Storage())
1591
1592 sendmail = webapi.config.get("sendmail_path", "/usr/sbin/sendmail")
1593
1594 assert not self.from_address.startswith("-"), "security"
1595
1596 for r in self.recipients:
1597 assert not r.startswith("-"), "security"
1598
1599 cmd = [sendmail, "-f", self.from_address] + self.recipients
1600
1601 p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
1602 p.stdin.write(message_text.encode("utf-8"))
1603 p.stdin.close()
1604 p.wait()
1605
1606 def __repr__(self):
1607 return "<EmailMessage>"

Callers 1

sendMethod · 0.95

Calls 3

StorageClass · 0.85
encodeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected