Alter "From" field in template

Hi there,we currently have several queues each responding to a different e-mail address.
However, all replies come via the generic “support” e-mail address.

I tried editing the template to do this. In the template the first part changes, successfully, the Subject of a message according to the queue.

What happens is:

  • if I only leave the part of the script for Subject, this works as expected
  • if I add the part of the script to change the “From” field, both don’t work.

Any idea?
The structure of my script follows.

Many thanks,
Giuseppe

{ "Z Support Job Logged: " . $Ticket->Subject . "

Thank you for contacting Z.

Initial request details:
" . $Transaction->Content . "

";}
elsif ($Ticket->QueueObj->Name eq ‘W’)

{…}

{ “z@sgul.ac.uk”;}
elsif ($Ticket->QueueObj->Name eq ‘W’)
{ “w@sgul.ac.uk”;}
else
{ “support@sgul.ac.uk”;
}

Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

Hi there,
we currently have several queues each responding to a different e-mail address.
However, all replies come via the generic “support” e-mail address.
I tried editing the template to do this. In the template the first part changes, successfully,
the Subject of a message according to the queue.
What happens is:

  • if I only leave the part of the script for Subject, this works as expected
  • if I add the part of the script to change the “From” field, both don’t work.
    The structure of my script follows.

I’m assuming everywhere you say “Script” you mean “Template”.

If you want to change headers, they have to go at the top. Look at
your code, it inserts a newline and $Transaction->Content.

I’m betting the mail goes out with a trailing From: at the bottom.

Put your From: first. Templates are like emails, Headers, blank line,
body.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Kevin,

The structure of my script follows.

I’m assuming everywhere you say “Script” you mean “Template”.

erm yes. I have this bad habit of calling the perl part of a template “a
script”. Sorry!

If you want to change headers, they have to go at the top. Look at
your code, it inserts a newline and $Transaction->Content.

I’m betting the mail goes out with a trailing From: at the bottom.

Put your From: first. Templates are like emails, Headers, blank line,
body.

Of course. They’re headers so they need to go before the body! Don’t
know why I didn’t think of it.

Many thanks,
G

Subject: { if ($Ticket->QueueObj->Name eq ‘Z’)
{ "Z Support Job Logged: " . $Ticket->Subject . "
Thank you for contacting Z.

Initial request details:
" . $Transaction->Content . "
";}
elsif ($Ticket->QueueObj->Name eq ‘W’)
{…}
From: { if ($Ticket->QueueObj->Name eq ‘Z’)
{ “z@sgul.ac.uk”;}
elsif ($Ticket->QueueObj->Name eq ‘W’)
{ “w@sgul.ac.uk”;}
else
{ “support@sgul.ac.uk”;
}


Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583
Twitter: http://twitter.com/sgulit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJRyqTAAAoJEAqigArPBfJXpQEH/1+9drpXZHDhyqQUnXuBO4oy
IXkaAE2dUTpyWANAde+TCNRrlnjAFGx4MHz2yqFoKohnCZSLdGjL4FyU06+lOX78
CfbYQgjPVy0Tqlj5p5tpT+sdsCTBvu+weB0SGTOgmkPidSkvYBKYGLIfp99xSbaM
I/un8xCK0x9l+ifxMfwQzsEVx5X0SsAS+3x30GQ5buPWQzSeyWeGh5KvYMwYINew
eF/cIDh5pgEfLg+yaFBtoppN0J/UQ3IPEnZstNrj+LyUs83773GmCM6yMHK9CIkO
y+eJeT3j/K3ZArOyAxbZeGvcNSN25V6fBj+TDggOZR7M9hSLxeVEUXjSLhKeKRc=
=INcL
-----END PGP SIGNATURE-----

0xCF05F257.asc (1.7 KB)