Automatic response

This forum is for discussing Mailtraq's Scripting features. Get help with Mailtraq scripts, templates and external ActiveX scripting.

Automatic response

Postby KazMax » Sat Mar 29th, 2008 9:21am

Useful suggestions on how I might implement the following would be greatly appreciated.

Recruitment agencies keep sending me email relating to job offers and it is a bit of a nuisance having to keep creating individual replies. I have now accepted an offer of employment and need to respond to the agents with a standard email reply. I thought I might be able to do this by creating a new mailbox which had an auto-reply, and then redirect incoming email to that mailbox which could automatically send out a standard reply. Setting this up is no problem, but I have a problem with the scripting of the response - it insists on responding to the email address from which the redirection took place (that is, my email address) rather than the agents email address.

Herewith my initial attempt at modifying the template which comes with MailTraq:
Code: Select all
// Automatic Reply to Mail (templates\autoresponder)
// -------------------------------------------------
// MAILBOX = Mailbox responding
//
{
  description := GetSystemVar("/mailslots/" ++ mailbox ++ "/Description");
  SelectOutMessage();
  SetHeader("Subject", "Automatic Reply from " ++ description);
  SetHeader("From", "andrew@mydomain.co.uk");
  SetHeader("To", Header("From"));                       <-- I thought this would pick up the 'From' address to reply to
  SelectInMessage()
}
Thank you for your email. Yada-yada-yada.

And here is the stripped down version of the headers for the email which is redirected to the auto-response mailbox I have created:
Code: Select all
Return-Path: <andrew@mydomain.co.uk>
Resent-From: Andrew <andrew@mydomain.co.uk>
Resent-To: autoresponder@mydomain.co.uk
From: Joe Agent <joe.agent@agency.com>
To: <andrew@mydomain.co.uk>
Subject: Job Opportunity

The problem is that instead of the auto-response going to joe.agent@agency.com, it is sent to andrew@mydomain.co.uk. Mailtraq scripting is picking up the "Return-Path" or "Resent-From" address in the header and acting on that, but what I really need to do is pick up on the original "From" address.

Is this possible? Or is there an easier way of me achieving the same functionality?

Thanks in anticipation,
Andrew
KazMax
 
Posts: 31
Joined: Sat Dec 08th, 2007 9:56am

Re: Automatic response

Postby Martin Clayton » Sat Apr 26th, 2008 8:03am

Hi Andrew,

Sorry for the late response. Hopefully, there will be some value (to some) at this stage...

KazMax wrote:Useful suggestions on how I might implement the following would be greatly appreciated.

Recruitment agencies keep sending me email relating to job offers and it is a bit of a nuisance having to keep creating individual replies. I have now accepted an offer of employment and need to respond to the agents with a standard email reply. I thought I might be able to do this by creating a new mailbox which had an auto-reply, and then redirect incoming email to that mailbox which could automatically send out a standard reply.

(Unless I'm misjudging the message volume and number of senders I'd be looking at automating response in the mail client).

Setting this up is no problem, but I have a problem with the scripting of the response - it insists on responding to the email address from which the redirection took place (that is, my email address) rather than the agents email address.
[...]
[code]
// Automatic Reply to Mail (templates\autoresponder)
// -------------------------------------------------
// MAILBOX = Mailbox responding
//
{
description := GetSystemVar("/mailslots/" ++ mailbox ++ "/Description");
SelectOutMessage();
SetHeader("Subject", "Automatic Reply from " ++ description);
SetHeader("From", "andrew@mydomain.co.uk");
SetHeader("To", Header("From")); <-- I thought this would pick up the 'From' address to reply to

I think the Header() call is working in the wrong context - try a SelectInMessage() before reading the header field.

Autoresponders are potentially dangerous beasts requiring a lot of safeguards to keep them under control. Mailtraq's out of the box template makes no attempt to 'do it properly' but there have been various implementations, like the attached, which shows Jim Hill's framework.

Cheers, Martin
Attachments
autoresponder.zip
autoresponder template
(1.36 KiB) Downloaded 641 times
User avatar
Martin Clayton
Expert User
 
Posts: 529
Joined: Sat Jan 15th, 2005 8:20am
Location: London, UK


Return to Mailtraq Scripting

Who is online

Users browsing this forum: No registered users and 1 guest