X-Fields in the headers

  • Thread starter Thread starter Trudeu
  • Start date Start date
T

Trudeu

Im trying to add X-fields to my out going outlook 2000.

I found this great link which in theory tells me exactly how to do this.
I have loaded redemption version 3.4.0.402, Removed the '| characters,
pasted it into "this outlook session", saved closed, but all I get is the
error message "There has been an error adding headers". (at least that
works)

http://www.sd-il.com/HabeasHeaders.html

I'm not using Habeas but figure I can remove most of the x fields and then
put my own text into the X-Habeas lines.

I have looked at the redemption site but Im afraid my knowledge does not get
me to the point where I can use the examples they provide.
They appear to be snippets, which I dont know how to integrate into a
working script.

Can anyone help me with what I'm doing wrong, or perhaps provide an example
of how to do this?

Thanks
 
Mr. Streblechenko,
Thanks for your response.
I'm not sure what you mean by what is your latest Code ? If you mean what
Redemption I'm using the Dll says Vers. 3.4.0.402. The actual script Im
using is at http://www.sd-il.com/HabeasHeaders.html . I will post it at the
BOTTOM of this email for clarity. Note that I have put at the end of the
lines, numbers '1 to '11 showing the sequence of how the program is
executed. I think that it is at '8 that it is failing. That is once it runs
that line it then goes to the error message, '9.

PrId = utils.GetIDsFromNames(Item.MAPIOBJECT,
"{00020386-0000-0000-C000-000000000046}", localProp, True) '8

I hope this is the information you are looking for.
Thank you.


Dmitry Streblechenko said:
What is your latest code? Which line of code produces the error?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-----------The code I copied ----
Dim utils

Private Sub Add_X_Header(ByVal Item As Object, Prop, Val As String)
'5

Const PT_STRING8 = &H1E

Dim PrId As Long
Dim localProp As String
Dim localVal As String
Dim foo As Integer

localProp = Prop
'6
localVal = Val
'7

' set high word of PrID to Property Id of Extended Header; create if
necessary
PrId = utils.GetIDsFromNames(Item.MAPIOBJECT,
"{00020386-0000-0000-C000-000000000046}", localProp, True) '8

' set the low word to PT_STRING8
PrId = PrId + PT_STRING8

foo = utils.HrSetOneProp(Item.MAPIOBJECT, PrId, localVal, True)

End Sub


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'1

Set utils = CreateObject("Redemption.MAPIUtils")
'2

On Error GoTo errorExit
'3
Add_X_Header Item, "X-Habeas-SWE-1", "winter into spring"
'4
Add_X_Header Item, "X-Habeas-SWE-2", "brightly anticipated"
Add_X_Header Item, "X-Habeas-SWE-3", "like Habeas SWE (tm)"
Add_X_Header Item, "X-Habeas-SWE-4", "Copyright 2002 Habeas (tm)"
Add_X_Header Item, "X-Habeas-SWE-5", "Sender Warranted Email (SWE) (tm).
The sender of this"
Add_X_Header Item, "X-Habeas-SWE-6", "email in exchange for a license
for this Habeas"
Add_X_Header Item, "X-Habeas-SWE-7", "warrant mark warrants that this is
a Habeas Compliant"
Add_X_Header Item, "X-Habeas-SWE-8", "Message (HCM) and not spam. Please
report use of this"
Add_X_Header Item, "X-Habeas-SWE-9", "mark in spam to
<http://www.habeas.com/report/>;."
Set utils = Nothing

Cancel = False
Exit Sub

errorExit:
MsgBox "There has been an error adding headers"
'9
Cancel = True
'10

End Sub
'11
 
Try to use false as the last parameter when calling HrSetOneProp:

foo = utils.HrSetOneProp(Item.MAPIOBJECT, PrId, localVal, false)

What is the error message? Try to modify your error handler as follows:

errorExit:
MsgBox "There has been an error adding headers - " & Err.Description



Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I have done what you have listed. It still fails. The error message is that
there is a "object required"
Thanks.
 
Here it is with your changes. Other Redemption code works.

Thanks.



'-----START -- OF CODE ----------

Dim utils



Private Sub Add_X_Header(ByVal Item As Object, Prop, Val As String)





Const PT_STRING8 = &H1E



Dim PrId As Long

Dim localProp As String

Dim localVal As String

Dim foo As Integer



localProp = Prop

localVal = Val



' set high word of PrID to Property Id of Extended Header; create if
necessary

PrId = utils.GetIDsFromNames(Item.MAPIOBJECT, _

"{00020386-0000-0000-C000-000000000046}", localProp, True)



' set the low word to PT_STRING8

PrId = PrId + PT_STRING8



' foo = utils.HrSetOneProp(Item.MAPIOBJECT, PrId, localVal, True)

foo = utils.HrSetOneProp(Item.MAPIOBJECT, PrId, localVal, False)





End Sub





Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)



Set utils = CreateObject("Redemption.MAPIUtils")





On Error GoTo errorExit

Add_X_Header Item, "X-Habeas-SWE-1", "winter into spring"

Add_X_Header Item, "X-Habeas-SWE-2", "brightly anticipated"

Add_X_Header Item, "X-Habeas-SWE-3", "like Habeas SWE (tm)"

Add_X_Header Item, "X-Habeas-SWE-4", "Copyright 2002 Habeas (tm)"

Add_X_Header Item, "X-Habeas-SWE-5", "Sender Warranted Email (SWE) (tm).
The sender of this"

Add_X_Header Item, "X-Habeas-SWE-6", "email in exchange for a license fo
r this Habeas"

Add_X_Header Item, "X-Habeas-SWE-7", "warrant mark warrants that this is
a Habeas Compliant"

Add_X_Header Item, "X-Habeas-SWE-8", "Message (HCM) and not spam. Please
report use of this"

Add_X_Header Item, "X-Habeas-SWE-9", "mark in spam to
<http://www.habeas.com/report/>;."



Set utils = Nothing



Cancel = False

Exit Sub



errorExit:

MsgBox "There has been an error adding headers"

Cancel = True



'errorExit:

MsgBox "There has been an error adding headers - " & Err.Description



End Sub

'--------------END OF CODE ---------
 
Mr Streblechenko,

As I had mentioned earlier, Im a novice at this so I may not be able to give
you the answer that you are looking for.
I can tell you that when I step into the routine it is right after the line
:
PrId = utils.GetIDsFromNames(Item.MAPIOBJECT,
"{00020386-0000-0000-C000-000000000046}", localProp, True)
that it fails. The value of PrId when I put my cursor over it is "0".

Im not sure what utils object is, (maybe thats the problem.)

thanks.
 
Back
Top