OTRS_CUSTOMER_REALNAME and Reply-To header

Moderator: crythias

Locked
aellert
Znuny newbie
Posts: 9
Joined: 29 Jul 2013, 11:00
Znuny Version: 3.2.9
Real Name: Alexandre Ellert
Company: Numeezy

OTRS_CUSTOMER_REALNAME and Reply-To header

Post by aellert »

Hello,

I have a web form which send email to a mailbox which is regulary fetched by OTRS to create new ticket.
These emails have a Reply-To header and OTRS correctly send an automatic answer only to the Reply-to address.

Now, if I use OTRS_CUSTOMER_REALNAME macro in the automatic answer, I'd like to :
- display the friendly name if present in the Reply-To header
- display the email address in the Reply-To header if this header exist
- if no reply-To header at all, then "normal" behaviour (i.e. display friendly From address if present. Or display From address)
Actually OTRS_CUSTOMER_REALNAME display is only base on From header.

Can you tell me how to achieve this ?

Many thanks.
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by reneeb »

Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
aellert
Znuny newbie
Posts: 9
Joined: 29 Jul 2013, 11:00
Znuny Version: 3.2.9
Real Name: Alexandre Ellert
Company: Numeezy

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by aellert »

Thanks for your answer.
Unfortunately, i'm not a Perl programmer and I have no skill to do that modification.
It will be great if you or someone who is comfortable with Perl code implement this functionality.
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by jojo »

hire a developer
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by crythias »

Aw, have a heart :)

https://github.com/OTRS/otrs/blob/rel-3 ... r.pm#L1453
Maybe change To to Reply-To
If it breaks, you get to keep both pieces.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
aellert
Znuny newbie
Posts: 9
Joined: 29 Jul 2013, 11:00
Znuny Version: 3.2.9
Real Name: Alexandre Ellert
Company: Numeezy

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by aellert »

I've made this modification and it seams to work :

Code: Select all

diff --git a/TemplateGenerator.pm.ori b/TemplateGenerator.pm
index d40a4bf..7300f58 100644
--- a/TemplateGenerator.pm.ori
+++ b/TemplateGenerator.pm
@@ -1449,8 +1449,15 @@ sub _Replace {
         }
 
         # generate real name based on sender line
+        # (try to get real name from "Reply-To" header
+        # if no "Reply-To" present then look at "From" header)
         if ( !$From ) {
-            $From = $Data{To} || '';
+            if ( $Data{"Reply-To"} ) {
+                $From = $Data{"Reply-To"} || '';
+            }
+            else {
+                $From = $Data{To} || '';
+            }
 
             # remove email addresses
             $From =~ s/<.*>|<.*>|\(.*\)|\"|"|;|,//g;
Is it the correct way to do it ?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by crythias »

oh. um. maybe not. I goofed. I have been a bit sick. Reply-To is like From, not To. Just ... sorry.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
aellert
Znuny newbie
Posts: 9
Joined: 29 Jul 2013, 11:00
Znuny Version: 3.2.9
Real Name: Alexandre Ellert
Company: Numeezy

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by aellert »

I think this is an inconsistent behaviour because OTRS automatic answer use the correct To: at SMTP level (it replies to the Reply-To: if present and to the From: when there's no Reply-To like any MUA when you click 'Answer') whereas OTRS_CUSTOMER_REALNAME always use value from the From: header and completely ignore the Reply-To.
This quick and dirty code I made works in my case, I've tested it extensively. I'm pretty sure someone who knows well OTRS framework could review it a very short time.
I can fill a bug if necessary.

PS : I've ask to "hire a developer" at commercial OTRS team. I was shocked to read that it will cost 1250 € to correct this little bug...
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by crythias »

it's free to submit the bug repair on github.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
aellert
Znuny newbie
Posts: 9
Joined: 29 Jul 2013, 11:00
Znuny Version: 3.2.9
Real Name: Alexandre Ellert
Company: Numeezy

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by aellert »

schulmann
Znuny wizard
Posts: 477
Joined: 20 Nov 2011, 16:08
Znuny Version: 6.5.11
Real Name: Schulmann

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by schulmann »

aellert wrote:I have a web form which send email to a mailbox which is regulary fetched by OTRS to create new ticket.
These emails have a Reply-To header and OTRS correctly send an automatic answer only to the Reply-to address.

Can you tell me how to achieve this ?
Your intended solution has a bad side effect: If there is a problem with the mail transport between your web form and your OTRS mailbox your customer will get a delivery failure message.
The delivery failure should be sent to you because you are responsible for the mail transport at this point.

There is a better solution:
  • For the smtp envelope from address you can use an arbitrary address from your own domain, for example your own mail address. Then you are automatically notified if there is a problem with mails betweeen your web form and your OTRS mailbox.
  • For the smtp header from address you can use the mail address of your customer. Then your customer will get the auto response from otrs.
By this method you don't need to modify OTRS.
Znuny6/Debian/ESXi
aellert
Znuny newbie
Posts: 9
Joined: 29 Jul 2013, 11:00
Znuny Version: 3.2.9
Real Name: Alexandre Ellert
Company: Numeezy

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by aellert »

Your intended solution has a bad side effect: If there is a problem with the mail transport between your web form and your OTRS mailbox your customer will get a delivery failure message.
The delivery failure should be sent to you because you are responsible for the mail transport at this point.
For the smtp envelope from address you can use an arbitrary address from your own domain, for example your own mail address. Then you are automatically notified if there is a problem with mails betweeen your web form and your OTRS mailbox.
Actually the envelope from is already an address from my own domain. So if delivery fails, I will get a bounce, not the customer.
For the smtp header from address you can use the mail address of your customer. Then your customer will get the auto response from otrs.
I must not use smtp header from domain I don't own. Because the domain might be DMARC protected (for exemple @yahoo.com or @aol.com) and may be detected as phishing.
So it's better to use my own domain in both smtp header and envelope from.
That's why I still think Reply-To is best to use.
schulmann
Znuny wizard
Posts: 477
Joined: 20 Nov 2011, 16:08
Znuny Version: 6.5.11
Real Name: Schulmann

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by schulmann »

aellert wrote:Actually the envelope from is already an address from my own domain. So if delivery fails, I will get a bounce, not the customer.
That's absolutely ok.
For the smtp header from address you can use the mail address of your customer. Then your customer will get the auto response from otrs.
I must not use smtp header from domain I don't own. Because the domain might be DMARC protected (for exemple @yahoo.com or @aol.com) and may be detected as phishing.
So it's better to use my own domain in both smtp header and envelope from.
That's why I still think Reply-To is best to use.
The decisive mail is the mail between your web form and your OTRS system. This mail is totally within your territory where you can disable DMARC, SPF and similar things for it - for example with white listing the ip address of your web form server - so they don't matter.

Again: By this method there is no need to modify OTRS.
Znuny6/Debian/ESXi
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS_CUSTOMER_REALNAME and Reply-To header

Post by crythias »

of course, you can also assign any X-OTRS headers from the form, too.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Locked