You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by di...@apache.org on 2022/09/07 14:37:58 UTC

[allura] branch dw/8460 created (now 87bb912c6)

This is an automated email from the ASF dual-hosted git repository.

dill0wn pushed a change to branch dw/8460
in repository https://gitbox.apache.org/repos/asf/allura.git


      at 87bb912c6 [#8460] add new email @task which sends an already formatted email content

This branch includes the following new commits:

     new 87bb912c6 [#8460] add new email @task which sends an already formatted email content

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[allura] 01/01: [#8460] add new email @task which sends an already formatted email content

Posted by di...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dill0wn pushed a commit to branch dw/8460
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 87bb912c6824342ff9c604faad545d23f15f841f
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Wed Sep 7 14:37:47 2022 +0000

    [#8460] add new email @task which sends an already formatted email content
---
 Allura/allura/lib/mail_util.py    | 8 ++++++--
 Allura/allura/tasks/mail_tasks.py | 7 +++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Allura/allura/lib/mail_util.py b/Allura/allura/lib/mail_util.py
index 374cb25ef..226a62b01 100644
--- a/Allura/allura/lib/mail_util.py
+++ b/Allura/allura/lib/mail_util.py
@@ -301,11 +301,15 @@ class SMTPClient:
             log.warning('No valid addrs in %s, so not sending mail',
                         list(map(str, addrs)))
             return
+
+        self.send(config.return_path, smtp_addrs, content)
+
+    def send(self, addr_from, smtp_addrs, content):
         if not self._client:
             self._connect()
         try:
             self._client.sendmail(
-                config.return_path,
+                addr_from,
                 smtp_addrs,
                 content)
             need_retry = False
@@ -322,7 +326,7 @@ class SMTPClient:
             # maybe could sleep?  or if we're in a task, reschedule it somehow?
             self._connect()
             self._client.sendmail(
-                config.return_path,
+                addr_from,
                 smtp_addrs,
                 content)
 
diff --git a/Allura/allura/tasks/mail_tasks.py b/Allura/allura/tasks/mail_tasks.py
index 541f47184..dda48888e 100644
--- a/Allura/allura/tasks/mail_tasks.py
+++ b/Allura/allura/tasks/mail_tasks.py
@@ -246,6 +246,13 @@ def sendsimplemail(
         in_reply_to, multi_msg, sender=sender, references=references, cc=cc, to=toaddr)
 
 
+@task
+def send_raw_content(mail_system, addr_from, addr_to, full_email_content):
+    log.info("send_raw_content {} from: {} to: {}".format(mail_system, addr_from, addr_to))
+    if mail_system == 'local':
+        smtp_client.send(addr_from, [addr_to], full_email_content)
+
+
 def send_system_mail_to_user(user_or_emailaddr, subject, text):
     '''
     Sends a standard email from the Allura system itself, to a user.