Automatically setting the ‘From’ address of a new Outlook message
Setting an alternate reply address is particularly useful if you are using a mail enabled public folder or distribution list for a group of users and would like the replies to messages that they send to go to the group smtp address instead of the sender’s mailbox.
There are a several ways to set the reply address for a new message. The first two methods that I will cover are acheived using a custom form. The other method is to set the address programmatically by using vbscript (or another language).
Custom Form methods:
There are 2 different ways to set the reply address using a custom form; both methods have slightly different results. The first method is to simply populate the ‘from’ field with the address that you’d like replies to be sent to. When using this method, the recipient will clearly see that the message has a different ‘from’ address and, as expected, when they hit reply their mail client will address the message to the ‘from’ address.
The second method is to click on the options button for the new message and enter an address in the “have replies sent to:” field. This method preserves the sender’s name, but sets a different reply address. The recipient will see that the message was sent by the sender, but when they hit reply the mail client will address the message to an alternate address.
With both of these methods you need to compose a new message, set the required options and then publish the item as a custom form. You can then use that custom form when you wish to send a message with the alternate reply address. There is a way that you can programmatically create a new message based a custom form; I promise I’ll post that soon.
Custom forms have their limitations however. For a start, the form needs to be published somewhere first; either in the organisational forms library, personal forms library, or a folder. Forms in the local forms cache are also prone to corruption and custom forms in general can be fiddly. Therefore the custom form method is not my preferred method.
Scripted Method (vbscript)
There are few different ways to make it easy for users to click a button to compose their message with the alternate reply address. You could write some VBA code and assign a toolbar button to it; when the users want to send a message using the alternate reply address they simply click the toolbar button. Another approach is to create an html folder homepage for a folder or public folder. In the html code, you can create a button to run some vbscript code to create the message and set the reply address (see below). The advantage to using a public folder homepage is that you avoid having to copy the VBA code to each workstation and manually creating a toolbar button. You can extend the concept by using the Outlook View Control(OVC) in your HTML homepage so that you have a ‘New Message’ button, and directly below have the contents of the public folder displayed in the OVC. The Outlook View Control is beyond the scope of this entry but because it’s so useful it’s on my list of blog topics!
When I first attempted to set the reply address using vbscript (before I downloaded the object model map!) I was trying to set the reply address using the wrong property. I tried two properties first: the SenderName and SenderEmailAddress properties. When I tried to set these properties with vbscript I would receive an error message stating “property is read-only”. If you refer to the object model you’ll see that these are in fact read-only.
The correct property to assign a reply address is the SentOnBehalfOfName property. I’ll admit that when I first saw this property I didn’t try it straight away as I assumed that it would have been read-only too based on the fact that the name of the property is in past tense (SentOnBehalfOfName). The SentOnBehalfOfName sets the ‘from’ field in the new message, so using this method has the same effect as the first custom form method above.
Here is an example of how create a new outlook mail item with an alternate reply address:
Set OlApp = CreateObject("Outlook.Application")
Set NewMessage = olApp.CreateItem(0)
NewMessage.SentOnBehalfOfName = "test@test.com"
NewMessage.Display
if you are scripting or programming with Outlook 2003, I recommend that you download the Outlook 2003 object model map from the microeye website (http://www.microeye.com/resources/code.htm).
Maximus said,
December 20, 2007 @ 9:13 pm
I would like to see a continuation of the topic
music said,
January 7, 2008 @ 3:52 pm
very interesting.
i’m adding in RSS Reader
Victor Ivanidze said,
February 26, 2008 @ 9:58 pm
Alternatively you can use this third-party utility:
http://www.ivasoft.com/setfrom.shtml
Regards,
Victor Ivanidze
lucydance said,
March 2, 2008 @ 9:13 pm
I have been in Network Marketing for about 15 years. I have NEVER seen such a total opportunity where almost everyone who takes a look wants to join. People just see the magic in this program
check it out by going to..
work at home online
itagmageofeve said,
March 18, 2008 @ 8:13 pm
I am trying to use this pic as an avatar but it would not load? Is it me or is this feature turned off?
Me in San Francisco2008
Stattygob said,
March 22, 2008 @ 8:52 pm
Snx for you job!
It has very much helped me!