rspamd_email_address_free (task->from_envelope);
}
+ if (task->from_envelope_orig) {
+ rspamd_email_address_free (task->from_envelope_orig);
+ }
+
if (task->meta_words) {
g_array_free (task->meta_words, TRUE);
}
GPtrArray *rcpt_envelope; /**< array of rspamd_email_address */
struct rspamd_email_address *from_envelope;
+ struct rspamd_email_address *from_envelope_orig;
ucl_object_t *messages; /**< list of messages that would be reported */
struct rspamd_re_runtime *re_rt; /**< regexp runtime */
/* Create table to preserve compatibility */
if (addr->addr) {
lua_createtable (L, 1, 0);
- lua_push_email_address (L, addr);
+ if (what & RSPAMD_ADDRESS_ORIGINAL) {
+ if (task->from_envelope_orig) {
+ lua_push_email_address (L, task->from_envelope_orig);
+ }
+ else {
+ lua_push_email_address (L, addr);
+ }
+ }
+ else {
+ lua_push_email_address (L, addr);
+ }
+
lua_rawseti (L, -2, 1);
}
else {
}
}
else if (paddr) {
+ /* SMTP from case */
if (lua_import_email_address (L, task, 3, &addr)) {
-
- if (paddr) {
- rspamd_email_address_free (*paddr);
- }
-
- *paddr = addr;
+ task->from_envelope_orig = *paddr;
+ task->from_envelope = addr;
lua_pushboolean (L, true);
}
else {