change from write oldfrom to subject

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
outrunner77
New user
New user
Posts: 5
Joined: 2019-04-30 12:10

change from write oldfrom to subject

Post by outrunner77 » 2019-06-26 12:50

Hi, I'm using the eventhandler script to change the from address and everything is working correctly, if possible I'd like to add to the script to write the original sender into the subject or message body. Is this possible?

For reference the script I'm using is below. Assume it would just be a matter of writing oldfrom into the message or subject.

Sub OnAcceptMessage(oClient, oMessage)
oldFrom = oMessage.FromAddress
oMessage.FromAddress = "s.relay@test.com"
oMessage.From = "<s.relay@test.com>"
oMessage.save
EventLog.Write("Testing account From rewrite " & oldFrom & " - to - " & oMessage.FromAddress )
Result.value = 0
End Sub

Thanks.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8261
Joined: 2011-09-08 17:48

Re: change from write oldfrom to subject

Post by jimimaseye » 2019-06-26 14:13

Example.
outrunner77 wrote:
2019-06-26 12:50

Sub OnAcceptMessage(oClient, oMessage)
oldFrom = oMessage.FromAddress
oMessage.FromAddress = "s.relay@test.com"
oMessage.From = "<s.relay@test.com>"
OMessage.subject = oldFrom & " " & omessage.subject
oMessage.save
EventLog.Write("Testing account From rewrite " & oldFrom & " - to - " & oMessage.FromAddress )
Result.value = 0
End Sub
[Entered by mobile. Excuse my spelling.]
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

outrunner77
New user
New user
Posts: 5
Joined: 2019-04-30 12:10

Re: change from write oldfrom to subject

Post by outrunner77 » 2019-06-26 14:40

Brilliant. Thank you I'll give it a go.

estradis
Normal user
Normal user
Posts: 154
Joined: 2014-09-09 10:47

Re: change from write oldfrom to subject

Post by estradis » 2019-07-25 17:30

Please keep in mind that subject changes will break DKIM.

Post Reply