Fossil SCM

Add a List-Unsubscribe: header to all notification emails.

drh 2021-05-28 15:01 trunk
Commit 4a3909afc8f9f3e1c450b68fbb47e1a0fac69064852ed2e1017ee1e0cbc2a35a
1 file changed +6 -3
+6 -3
--- src/alerts.c
+++ src/alerts.c
@@ -1582,12 +1582,13 @@
15821582
15831583
db_multi_exec(
15841584
"DELETE FROM subscriber WHERE subscriberId=%d", sid
15851585
);
15861586
style_header("Unsubscribed");
1587
- @ <p>The "%h(zEmail)" email address has been unsubscribed and the
1588
- @ corresponding row in the subscriber table has been deleted.<p>
1587
+ @ <p>The "%h(zEmail)" email address has been unsubscribed from all
1588
+ @ notifications. All subscription records for "%h(zEmail)" have
1589
+ @ been purged. No further emails will be sent to "%h(zEmail)".</p>
15891590
if( uid && g.perm.Admin ){
15901591
@ <p>You may also want to
15911592
@ <a href="%R/setup_uedit?id=%d(uid)">edit or delete
15921593
@ the corresponding user "%h(zLogin)"</a></p>
15931594
}
@@ -2601,11 +2602,11 @@
26012602
AlertSender *pSender = 0;
26022603
u32 senderFlags = 0;
26032604
26042605
if( g.fSqlTrace ) fossil_trace("-- BEGIN alert_send_alerts(%u)\n", flags);
26052606
alert_schema(0);
2606
- if( !alert_enabled() ) goto send_alert_done;
2607
+ if( !alert_enabled() && (flags & SENDALERT_STDOUT)==0 ) goto send_alert_done;
26072608
zUrl = db_get("email-url",0);
26082609
if( zUrl==0 ) goto send_alert_done;
26092610
zRepoName = db_get("email-subname",0);
26102611
if( zRepoName==0 ) goto send_alert_done;
26112612
zFrom = db_get("email-self",0);
@@ -2753,10 +2754,12 @@
27532754
blob_append(&body, "\n", 1);
27542755
blob_append(&body, blob_buffer(&p->txt), blob_size(&p->txt));
27552756
}
27562757
}
27572758
if( nHit==0 ) continue;
2759
+ blob_appendf(&hdr, "List-Unsubscribe: <%s/unsubscribe/%s>\r\n",
2760
+ zUrl, zCode);
27582761
blob_appendf(&body,"\n-- \nSubscription info: %s/alerts/%s\n",
27592762
zUrl, zCode);
27602763
alert_send(pSender,&hdr,&body,0);
27612764
nSent++;
27622765
blob_truncate(&hdr, 0);
27632766
--- src/alerts.c
+++ src/alerts.c
@@ -1582,12 +1582,13 @@
1582
1583 db_multi_exec(
1584 "DELETE FROM subscriber WHERE subscriberId=%d", sid
1585 );
1586 style_header("Unsubscribed");
1587 @ <p>The "%h(zEmail)" email address has been unsubscribed and the
1588 @ corresponding row in the subscriber table has been deleted.<p>
 
1589 if( uid && g.perm.Admin ){
1590 @ <p>You may also want to
1591 @ <a href="%R/setup_uedit?id=%d(uid)">edit or delete
1592 @ the corresponding user "%h(zLogin)"</a></p>
1593 }
@@ -2601,11 +2602,11 @@
2601 AlertSender *pSender = 0;
2602 u32 senderFlags = 0;
2603
2604 if( g.fSqlTrace ) fossil_trace("-- BEGIN alert_send_alerts(%u)\n", flags);
2605 alert_schema(0);
2606 if( !alert_enabled() ) goto send_alert_done;
2607 zUrl = db_get("email-url",0);
2608 if( zUrl==0 ) goto send_alert_done;
2609 zRepoName = db_get("email-subname",0);
2610 if( zRepoName==0 ) goto send_alert_done;
2611 zFrom = db_get("email-self",0);
@@ -2753,10 +2754,12 @@
2753 blob_append(&body, "\n", 1);
2754 blob_append(&body, blob_buffer(&p->txt), blob_size(&p->txt));
2755 }
2756 }
2757 if( nHit==0 ) continue;
 
 
2758 blob_appendf(&body,"\n-- \nSubscription info: %s/alerts/%s\n",
2759 zUrl, zCode);
2760 alert_send(pSender,&hdr,&body,0);
2761 nSent++;
2762 blob_truncate(&hdr, 0);
2763
--- src/alerts.c
+++ src/alerts.c
@@ -1582,12 +1582,13 @@
1582
1583 db_multi_exec(
1584 "DELETE FROM subscriber WHERE subscriberId=%d", sid
1585 );
1586 style_header("Unsubscribed");
1587 @ <p>The "%h(zEmail)" email address has been unsubscribed from all
1588 @ notifications. All subscription records for "%h(zEmail)" have
1589 @ been purged. No further emails will be sent to "%h(zEmail)".</p>
1590 if( uid && g.perm.Admin ){
1591 @ <p>You may also want to
1592 @ <a href="%R/setup_uedit?id=%d(uid)">edit or delete
1593 @ the corresponding user "%h(zLogin)"</a></p>
1594 }
@@ -2601,11 +2602,11 @@
2602 AlertSender *pSender = 0;
2603 u32 senderFlags = 0;
2604
2605 if( g.fSqlTrace ) fossil_trace("-- BEGIN alert_send_alerts(%u)\n", flags);
2606 alert_schema(0);
2607 if( !alert_enabled() && (flags & SENDALERT_STDOUT)==0 ) goto send_alert_done;
2608 zUrl = db_get("email-url",0);
2609 if( zUrl==0 ) goto send_alert_done;
2610 zRepoName = db_get("email-subname",0);
2611 if( zRepoName==0 ) goto send_alert_done;
2612 zFrom = db_get("email-self",0);
@@ -2753,10 +2754,12 @@
2754 blob_append(&body, "\n", 1);
2755 blob_append(&body, blob_buffer(&p->txt), blob_size(&p->txt));
2756 }
2757 }
2758 if( nHit==0 ) continue;
2759 blob_appendf(&hdr, "List-Unsubscribe: <%s/unsubscribe/%s>\r\n",
2760 zUrl, zCode);
2761 blob_appendf(&body,"\n-- \nSubscription info: %s/alerts/%s\n",
2762 zUrl, zCode);
2763 alert_send(pSender,&hdr,&body,0);
2764 nSent++;
2765 blob_truncate(&hdr, 0);
2766

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button