Viewing all headers

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
Hotlanta
Normal user
Normal user
Posts: 46
Joined: 2006-12-04 20:46

Viewing all headers

Post by Hotlanta » 2006-12-22 02:29

Is there a way to view the full text of the header in a email, or better yet, to see all of the headers individually without knowing their names or if they exist?

I would like to be able to see the full path of where mail came from. If I pull the "Received" header, it only shows me the last one. If there are multiple Received headers, the rest don't appear to be viewable.

Is there a collection of headers that would allow me to cycle through the collection and view them?

John

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2006-12-22 12:08

No, the COM API doesn't support that today. If you want to do it, you need to manually read the message file to retreive the headers. Sounds like a good thing to add though. Perhaps a hMailServer.MessageHeaders collection which allows you to iterate over all the headers in the email like this?

for i = 1 to oMessage.Headers.Count
msgbox oMessage.Headers(i).Name & " " & oMessage.Headers(i).Value
next i
oMessage.Headers.Add("newheader", "newheadervalue")

Hotlanta
Normal user
Normal user
Posts: 46
Joined: 2006-12-04 20:46

Post by Hotlanta » 2006-12-22 17:50

Looks like that would work great.

I have a related question. In reviewing how easy it is to add and modify headers, it appears to me that any spammer that wanted to hide where mail comes from could easily do so by just rewriting the headers on the last hop. I never realized until today that the only header value we can really trust is the last Received header put there by our own server. Would that be accurate?

Regards,

John

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2006-12-22 20:03

You mean the "Received" headers? Yes, any spammer can write whatever he wants in the received headers. The only safe one is the last added since it's added by a server you trust.

Post Reply