Solved

Auto Forwarding, but changing the reply address.

Posted on 1998-12-29
2
221 Views
Last Modified: 2012-06-21
I have a virtual domain with my ISP and e-mail is setup with *@mydomain.com all routed to me@myisp.com. This way a@mydomain.com and b@mydomain.com are all sent to me@myisp.com, but the TO: field is still kept a@mydomain.com, etc. I then have a network setup with one system that has Internet access, and outlook 98 checks the e-mail, then forwards via a Win95 MS Mail Postoffice to the correct people on the postoffice depending on the TO: field from the Internet mail. The system doing the forwarding is setup with a Postoffice account called "InternetMail", so that is who they reply to when they get forwarded e-mail addresses. Is there a way to do one (or both) of the following...

1) Change the reply address on the forwarded message to the FROM: field of the orinal Internet e-mail.
2) Append the FROM: field of the original Internet e-mail to the body of the message being forwarded.

This would make it alot easier for people to reply. They do have the ability to send Internet mail from their systems if the to address is Internet style.

If you need a more detailed explanation e-mail me at harley@aracnet.com

Thanks,
Josh

P.S. I DO NOT need to know how to setup rules for forwarding, deleting, etc., I have already done that. I just need to change the reply address or append it.
0
Comment
Question by:Draco
2 Comments
 
LVL 2

Accepted Solution

by:
Bodya earned 200 total points
ID: 1622387
The most convenient way - to write a VB programm which scans your Inbox and check's the incoming mail and changes the From field according to the information in the message's body.
What I have discovered is the following: one can't programmatically change the address contained in a FROM field.
But there is a bypass: you can change so called "Have replies sent to" field.
First I explain that it will do you not harm, if you change this Field but not From field. In Outlook you can edit the View of your folder and select which fields to show and which not. Also it is the "Have replies sent to" field that defines to whom the Outlook will send the letter if you click on Reply. So, here I just tried to persuade you that changing the "Have replies sent to" field to the address from where your message have been originated can solve all your problems in Outlook and you needn't to bother about the FROM field.

The are following general steps
--------------------------------------
1. Get reference to the Outlook instance and NameSpace, for example
set oApp = CreateObject("Outlook.Application")
set oNS = oApp.GetNameSpace("MAPI")

2. Obtain the reference to your folder, where all forwarded mail items are expected to be found. This may be

Set oFolder = oNS.GetDefaultFolder(olFolderInbox)
'or
Set oFolder = oNS.Folders("Personal Folders").Folders("Inbox")

3. Write an iteration loop which processes all items in your folder

For Each oItem In oFolder.Items
  If TypeName(oItem) = "MailItem" Then
      'call the procedure to process a mailitem
      ProcessMailItem oItem
  End If
Next

4. What is left now - is to write the procedure which looks for the original address in the message body, extracts it and put just in the "Have replies sent to" field . It can be like this

Private Sub ProcessMailItem(oItem As Object)
Dim strTemp As String
Dim BeginAddress As Integer
Dim EndAddress As Integer
Dim strAddress As String

'here you should check, if the item is a forwarded letter
strTemp = oItem.Subject
If Not strTemp Like "FW:*" Then Exit Sub
strTemp = oItem.Body
BeginAddress = InStr(1, strTemp, "From:") + 6
EndAddress = InStr(BeginAddress, strTemp, vbNewLine)
'here we are trying to find an address
strAddress = Mid(strTemp, BeginAddress, EndAddress - BeginAddress)

      'remove all old values from the "Have replies sent to" field and add a new one
While oItem.ReplyRecipients.Count = 1
oItem.ReplyRecipients.Remove 1
Wend
Item.ReplyRecipients.Add (strAddress)
oItem.ReplyRecipients.ResolveAll
oItem.Save
End Sub

This routine, of cause, is only a carcass of real routine that must handle various exceptions etc.
Finally you should write a routine to make the programmm automatically scan your inbox in a certain periods of time.
---------------------------------------------------

More information about programming Outlook on VB you can get  from
http://www.microsoft.com/OutlookDev/Articles/outprog.htm

Good luck,
Bodya

P.S. Of cause such a programm may be already written , but isn't it a fancy to make it by yourself. May be I will write it myself when I will have a little more time, 'cause you are not the fisrt person who asks such a question.
0
 

Author Comment

by:Draco
ID: 1622388
Thanks for all of the info, I haven't gotten to try it out yet, but it looks like it should work and makes sense, the only thing I don't see is where the message is actually sent out. At this point we have rules setup (we are using Outlook98) to automatically forward the message when new mail comes in. I assume that would be changed, but the question is when I modify the reply to field the message is going to have to be sent right away, so how do I have my program do that?

It is an excellent answer so far, there are just a few things that I need cleared up a little.

Thanks,
Josh
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
Set OWA language and time zone in Exchange for individuals, all users or per database.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now