processed = 1;
}
+ else if (!strcasecmp(key, "Return-Path")) {
+ if (msg->cm_fields['P'] == NULL)
+ msg->cm_fields['P'] = strdup(value);
+ processed = 1;
+ }
+
+ else if (!strcasecmp(key, "Envelope-To")) {
+ if (msg->cm_fields['V'] == NULL)
+ msg->cm_fields['V'] = strdup(value);
+ processed = 1;
+ }
+
/* Clean up and move on. */
free(key); /* Don't free 'value', it's actually the same buffer */
return(processed);
vptr->next = cs->u->first_vacation;
cs->u->first_vacation = vptr;
- return SIEVE2_ERROR_UNSUPPORTED;
+ return SIEVE2_OK;
+ /* return SIEVE2_ERROR_UNSUPPORTED; */
}
/*
* Callback function to parse message envelope
*/
-#if 0
int ctdl_getenvelope(sieve2_context_t *s, void *my)
{
- return SIEVE2_ERROR_UNSUPPORTED;
+ struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
+
+ lprintf(CTDL_DEBUG, "Action is GETENVELOPE\n");
+ sieve2_setvalue_string(s, "to", cs->envelope_to);
+ sieve2_setvalue_string(s, "from", cs->envelope_from);
+ return SIEVE2_OK;
}
-#endif
/*
else {
strcpy(my.subject, "");
}
-
+
+ /* Keep track of the envelope-from address (use body-from if not found) */
+ if (msg->cm_fields['P'] != NULL) {
+ safestrncpy(my.envelope_from, msg->cm_fields['P'], sizeof my.envelope_from);
+ }
+ else if (msg->cm_fields['F'] != NULL) {
+ safestrncpy(my.envelope_from, msg->cm_fields['F'], sizeof my.envelope_from);
+ }
+ else {
+ strcpy(my.envelope_from, "");
+ }
+
+ /* Keep track of the envelope-to address */
+ if (msg->cm_fields['V'] != NULL) {
+ safestrncpy(my.envelope_to, msg->cm_fields['V'], sizeof my.envelope_to);
+ }
+ else {
+ strcpy(my.envelope_to, "");
+ }
free(msg);
{ SIEVE2_DEBUG_TRACE, ctdl_debug },
{ SIEVE2_MESSAGE_GETALLHEADERS, ctdl_getheaders },
{ SIEVE2_MESSAGE_GETSIZE, ctdl_getsize },
+ { SIEVE2_MESSAGE_GETENVELOPE, ctdl_getenvelope },
/*
* These actions are unsupported by Citadel so we don't declare them.
*
{ SIEVE2_ACTION_NOTIFY, ctdl_notify },
{ SIEVE2_MESSAGE_GETSUBADDRESS, ctdl_getsubaddress },
- { SIEVE2_MESSAGE_GETENVELOPE, ctdl_getenvelope },
{ SIEVE2_MESSAGE_GETBODY, ctdl_getbody },
*
*/
msg->cm_fields['O'] = strdup(MAILROOM);
}
+ /* Set the "envelope from" address */
+ if (msg->cm_fields['P'] != NULL) {
+ free(msg->cm_fields['P']);
+ }
+ msg->cm_fields['P'] = strdup(SMTP->from);
+
+ /* Set the "envelope to" address */
+ if (msg->cm_fields['V'] != NULL) {
+ free(msg->cm_fields['V']);
+ }
+ msg->cm_fields['V'] = strdup(SMTP->recipients);
+
/* Submit the message into the Citadel system. */
valid = validate_recipients(SMTP->recipients);
of seconds since January 1, 1970 GMT).
U sUbject Optional. Developers may choose whether they wish to
generate or display subject fields.
+V enVelope-to The recipient specified in incoming SMTP messages.
Y carbon copY Optional, and only in Mail messages.
0 Error This field is typically never found in a message on
disk or in transit. Message scanning modules are