When a un-/subscribe command needs confirmation, the request for
confirmation is sent to the address that is supposed to added to or removed from the list. If, and only if, this address is different than the one from which the request came, a short mail is sent to the requestor to inform him what is going on.
This commit is contained in:
parent
5cffe86638
commit
0670963e12
59
subscribe.c
59
subscribe.c
@ -213,7 +213,7 @@ AddAddress(struct Mail * MailStruct,
|
||||
char* command = text_easy_sprintf("subscribe %s %s", address, listname);
|
||||
char* cookie = queue_command(MailStruct, command);
|
||||
|
||||
/* Notify the owner. */
|
||||
/* Send request for confirmation to the user. */
|
||||
|
||||
fh = vOpenMailer(envelope, address, NULL);
|
||||
if (fh != NULL)
|
||||
@ -224,35 +224,48 @@ AddAddress(struct Mail * MailStruct,
|
||||
fprintf(fh, "Precedence: junk\n");
|
||||
fprintf(fh, "Sender: %s\n", envelope);
|
||||
fprintf(fh, "\n");
|
||||
buffer = text_easy_sprintf("Per request from \"%s\", the address \"%s\" should be subscribed to " \
|
||||
"the mailing list \"%s\". This will not happen unless you confirm the " \
|
||||
"request by replying to this mail and citing the string",
|
||||
originator, address, listname);
|
||||
if (strcasecmp(address, originator) == 0)
|
||||
buffer = text_easy_sprintf("You requested that the address \"%s\" should be subscribed to " \
|
||||
"the mailing list \"%s\". This will not happen unless you confirm the " \
|
||||
"request by replying to this mail and citing the string",
|
||||
address, listname);
|
||||
else
|
||||
buffer = text_easy_sprintf("Per request from \"%s\", the address \"%s\" should be subscribed to " \
|
||||
"the mailing list \"%s\". This will not happen unless you confirm the " \
|
||||
"request by replying to this mail and citing the string",
|
||||
originator, address, listname);
|
||||
text_wordwrap(buffer, 70);
|
||||
fprintf(fh, "%s\n", buffer);
|
||||
fprintf(fh, "\n %s\n\n", cookie);
|
||||
fprintf(fh, "in your reply.\n");
|
||||
CloseMailer(fh);
|
||||
|
||||
fh = vOpenMailer(envelope, originator, NULL);
|
||||
if (fh != NULL)
|
||||
/* If the request for confirmation has been sent to an
|
||||
address different to that of the originator, notify him
|
||||
what happened. */
|
||||
|
||||
if (strcasecmp(address, originator) != 0)
|
||||
{
|
||||
fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn);
|
||||
fprintf(fh, "To: %s\n", originator);
|
||||
fprintf(fh, "Subject: Petidomo: Your request \"subscribe %s %s\"\n", address, listname);
|
||||
if (MailStruct->Message_Id != NULL)
|
||||
fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id);
|
||||
fprintf(fh, "Precedence: junk\n");
|
||||
fprintf(fh, "Sender: %s\n", envelope);
|
||||
fprintf(fh, "\n");
|
||||
fprintf(fh, "Subscribing the address will need confirmation. Such a\n");
|
||||
fprintf(fh, "request has been sent to the address already, so don't move!\n");
|
||||
CloseMailer(fh);
|
||||
}
|
||||
else
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator);
|
||||
return -1;
|
||||
fh = vOpenMailer(envelope, originator, NULL);
|
||||
if (fh != NULL)
|
||||
{
|
||||
fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn);
|
||||
fprintf(fh, "To: %s\n", originator);
|
||||
fprintf(fh, "Subject: Petidomo: Your request \"subscribe %s %s\"\n", address, listname);
|
||||
if (MailStruct->Message_Id != NULL)
|
||||
fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id);
|
||||
fprintf(fh, "Precedence: junk\n");
|
||||
fprintf(fh, "Sender: %s\n", envelope);
|
||||
fprintf(fh, "\n");
|
||||
fprintf(fh, "Subscribing the address will need confirmation. Such a\n");
|
||||
fprintf(fh, "request has been sent to the address already, so don't move!\n");
|
||||
CloseMailer(fh);
|
||||
}
|
||||
else
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -218,6 +218,8 @@ DeleteAddress(struct Mail * MailStruct,
|
||||
char* command = text_easy_sprintf("unsubscribe %s %s", address, listname);
|
||||
char* cookie = queue_command(MailStruct, command);
|
||||
|
||||
/* Send request for confirmation to the user. */
|
||||
|
||||
fh = vOpenMailer(envelope, address, NULL);
|
||||
if (fh != NULL)
|
||||
{
|
||||
@ -227,10 +229,16 @@ DeleteAddress(struct Mail * MailStruct,
|
||||
fprintf(fh, "Precedence: junk\n");
|
||||
fprintf(fh, "Sender: %s\n", envelope);
|
||||
fprintf(fh, "\n");
|
||||
buffer = text_easy_sprintf("Per request from \"%s\", the address \"%s\" should be unsubscribed from " \
|
||||
"the mailing list \"%s\". This will not happen unless you confirm the " \
|
||||
"request by replying to this mail and citing the string",
|
||||
originator, address, listname);
|
||||
if (strcasecmp(address, originator) == 0)
|
||||
buffer = text_easy_sprintf("You requested that the address \"%s\" should be unsubscribed from " \
|
||||
"the mailing list \"%s\". This will not happen unless you confirm the " \
|
||||
"request by replying to this mail and citing the string",
|
||||
originator, address, listname);
|
||||
else
|
||||
buffer = text_easy_sprintf("Per request from \"%s\", the address \"%s\" should be unsubscribed from " \
|
||||
"the mailing list \"%s\". This will not happen unless you confirm the " \
|
||||
"request by replying to this mail and citing the string",
|
||||
originator, address, listname);
|
||||
text_wordwrap(buffer, 70);
|
||||
fprintf(fh, "%s\n", buffer);
|
||||
fprintf(fh, "\n %s\n\n", cookie);
|
||||
@ -243,25 +251,32 @@ DeleteAddress(struct Mail * MailStruct,
|
||||
return -1;
|
||||
}
|
||||
|
||||
fh = vOpenMailer(envelope, originator, NULL);
|
||||
if (fh != NULL)
|
||||
/* If the request for confirmation has been sent to an
|
||||
address different to that of the originator, notify him
|
||||
what happened. */
|
||||
|
||||
if (strcasecmp(address, originator) == 0)
|
||||
{
|
||||
fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn);
|
||||
fprintf(fh, "To: %s\n", originator);
|
||||
fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s %s\"\n", address, listname);
|
||||
if (MailStruct->Message_Id != NULL)
|
||||
fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id);
|
||||
fprintf(fh, "Precedence: junk\n");
|
||||
fprintf(fh, "Sender: %s\n", envelope);
|
||||
fprintf(fh, "\n");
|
||||
fprintf(fh, "Unsubscribing the address will need confirmation. Such a\n");
|
||||
fprintf(fh, "request has been sent to the address already, so don't move!\n");
|
||||
CloseMailer(fh);
|
||||
}
|
||||
else
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator);
|
||||
return -1;
|
||||
fh = vOpenMailer(envelope, originator, NULL);
|
||||
if (fh != NULL)
|
||||
{
|
||||
fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn);
|
||||
fprintf(fh, "To: %s\n", originator);
|
||||
fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s %s\"\n", address, listname);
|
||||
if (MailStruct->Message_Id != NULL)
|
||||
fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id);
|
||||
fprintf(fh, "Precedence: junk\n");
|
||||
fprintf(fh, "Sender: %s\n", envelope);
|
||||
fprintf(fh, "\n");
|
||||
fprintf(fh, "Unsubscribing the address will need confirmation. Such a\n");
|
||||
fprintf(fh, "request has been sent to the address already, so don't move!\n");
|
||||
CloseMailer(fh);
|
||||
}
|
||||
else
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user