We help IT Professionals succeed at work.

Autoforward email and change from to the first emailaddress found in the body.

322 Views
Last Modified: 2020-09-18
Hi,

We receive email from one address (let's say ticketsystemA@domain.com) with support tickets, we want those emails to be imported by our other ticket system.
The problem is that all tickets are send from the same user. So when we import, all tickets belong to ticketssystemA.

The first line of the body contains the emailadress of the real user that created the ticket, the rest of the body contains the ticket (and perhaps attachments).

We would like to autoforward the mail to ticketsystemB@domain.com with the sender adress being changed to the address found in the FIRST line of the email.

We have an on-prem Exchange 2016, the ticketsystemB is Always on the same domain as the real ticket creator.


Sorry for my bad English
Comment
Watch Question

MaheshArchitect
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
You cannot change email originator address no matter you forward emails as far as I know
So if A send mail to B and if it auto forwarded to c, then c should see A as sender
U may also redirect emails to C with same effect by using transport rule

Author

Commented:
Perhaps not with Exchange, but maybe with powershell it's posible?

With VB (and Outlook) it's possible: https://www.experts-exchange.com/questions/28492433/Extract-email-address-from-body-and-auto-reply.html
Aaron GuilmetteTechnology Solutions Professional
CERTIFIED EXPERT

Commented:
You could create a script with EWS and send the email.

I wrote a blog on processing messages in an inbox:

https://blogs.technet.microsoft.com/undocumentedfeatures/2016/07/18/create-an-opt-out-tool-for-exchange-online/

Author

Commented:
Yes @Aaron, I think that would be perfect... but a bit to complex for me I'm afraid...
Douglas SuyemotoGlobal Support Services Engineer
CERTIFIED EXPERT

Commented:
Have you tried just setting up a server-side rule on the mailbox 'ticketsystemA@domain.com' to redirect to 'ticketsystemB@domain.com' and save a copy in the original mailbox?  This will retain the original sender when received by ticketsystemB and will also allow tickets to be created in ticketsystemA.

Author

Commented:
For clarification: I would like to create a PowerShell script that can read incoming email, parse the first line to extract the email address and resend the email with using the email we extracted as the from.

I'm a bit of a powershell noob so I need a bit more help.

I have nothing yet.
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
A PS script cannot do magic, it is even slightly more difficult to get access to emails, and still requires to have an Outlook profile set up (or use EWS with Exchange).
It's much better to leave PS aside, and run something in Outlook VBA. But that doesn't change that you cannot set arbitrary addresses as sender, unless you allow relying on a specific SMTP server set up for that sole purpose ;-).
Your best choice is to apply the processing when a reply is composed - then you can set the recipient to that real address.

Author

Commented:
Tnx for the reply!
Can you provide an example which I can modify?
The emails are only internal and the destination also.
Scott FellDeveloper
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2013

Commented:
Does your ticketing system have an API. That may be an easier route as the others are saying what you are trying to do can not be done. But if you can at least extract the address on the incoming initial email, you can hit the api and update.
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
I forgot to ask which application creates the reply? If it is your ticket system, you'll have to modify it there.
If we can use Outlook, a event handler for the MailItem.Reply event can parse the (cited) email body and change the address.

Author

Commented:
No, the ticket system cannot be changed (we are migrating to another ticket system because of this). Only some departments still use this old system hence my question.

I really need somthing (VB or Powershell) that logs into a mailbox, retrieves the emails, changes the from (to the first email found in body) and resends it to another mailbox (same organisation)).
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
Why resend it? Does the new ticket system take that info on receive, so it has to be correct already at that stage?
If so: Maybe you can set up the new ticket system to monitor a different inbox folder, then use VBA code (optionally together with a rule) to modify the sender info and move to the ticket's inbox (move ≠ send!).

Author

Commented:
The OLD ticket system can only use one sender emailadress. The new ticketsystem can only read one mailbox and uses the sender adress to know who is the ticket owner.
With normal tickets that gets send to that emailadress that's no problem, but everything that comes out of the old ticket system has thus only on ticket owner…

Trust me, I need what I ask :)
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
Then the main point of my recommendation is to not require a send with modified addresses, but switch to a move between folders (of different or same accounts) after modifying the "from" part.
This might require using a third account (e.g. ticketSystemA, ticketSystemB and the transfer ticketSystemAB). A sends to AB, and an Outlook with AB and B account (can't do that in Exchange itself) runs VBA code to
  • change FROM according to the first body line
  • change TO to ticketSystemB
  • move from AB inbox to B inbox
The reason for the third account is that you probably cannot set the new ticketing system to check a different inbox folder, and you still need the normal inbox for the "real" communication for tickets.

Author

Commented:
I can't do anything with the answers :(
Developer
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2013
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you for your answers, I will have a look at the links and tell you guys the outcome :)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.