Change oder Update From

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
much_r
New user
New user
Posts: 11
Joined: 2020-04-01 14:50

Change oder Update From

Post by much_r » 2020-04-29 14:13

Hi,

is there a possibility to change "From" with the email address of the local user?

Example:
From (Senderaddress) = "test@rubner.com" or "empty From"
User in hMailserver = "mailuser@company.com"

Change "test@rubner.com" to "mailuser@company.com" and then send
Or even change "empty From" to "mailuser@company.com" and then send

Thanks and greetings
Michael

User avatar
RvdH
Senior user
Senior user
Posts: 1136
Joined: 2008-06-27 14:42
Location: Netherlands

Re: Change oder Update From

Post by RvdH » 2020-04-29 14:17

Why you would like to do something like that?
CIDR to RegEx: d-fault.nl/CIDRtoRegEx
DNS Lookup: d-fault.nl/DNSTools
DNSBL Lookup: d-fault.nl/DNSBLLookup
GEOIP Lookup: d-fault.nl/GeoipLookup

much_r
New user
New user
Posts: 11
Joined: 2020-04-01 14:50

Re: Change oder Update From

Post by much_r » 2020-04-29 14:39

Hi,

thanks for the answer :-)

An important application unfortunately sends mails with empty senders. Unfortunately I can't change that ...

Our SPAM filter blocks emails with empty senders.

Greetings
Michael

User avatar
RvdH
Senior user
Senior user
Posts: 1136
Joined: 2008-06-27 14:42
Location: Netherlands

Re: Change oder Update From

Post by RvdH » 2020-04-29 14:46

What are we talking about? The Envelope From or the Message From?

Hint :!:

Code: Select all

Sub OnAcceptMessage(oClient, oMessage)
	if Len(oMessage.FromAddress)=0 Then
		oMessage.FromAddress = "new@example.com"
		oMessage.From = "<new@example.com>"
		oMessage.save
	end if
End Sub
CIDR to RegEx: d-fault.nl/CIDRtoRegEx
DNS Lookup: d-fault.nl/DNSTools
DNSBL Lookup: d-fault.nl/DNSBLLookup
GEOIP Lookup: d-fault.nl/GeoipLookup

much_r
New user
New user
Posts: 11
Joined: 2020-04-01 14:50

Re: Change oder Update From

Post by much_r » 2020-04-29 16:10

That is exactly what I have been looking for.

Many thanks
best greetings

User avatar
katip
Senior user
Senior user
Posts: 779
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Change oder Update From

Post by katip » 2020-04-29 21:41

you can also try General Rules.
if From contains "test@rubner.com"
Set Header value From "mailuser@company.com"

empty From is tricky. to identify only outgoing mails you have to lookup a header in Custom header field such as Message-ID which (usually) contains your domain name or better a specific header added by your sending application (or even Subject if it adds something significant there).
if From doesn't contain "@" and Custom header field X-Yz contains "something significant"
Set Header value From "mailuser@company.com"
Katip
--
HMS 5.7.0 x64, MariaDB 10.4.10 x64, SA 3.4.2, ClamAV 0.101.2 + SaneS

much_r
New user
New user
Posts: 11
Joined: 2020-04-01 14:50

Re: Change oder Update From

Post by much_r » 2020-05-26 18:41

Hi katip

Thank you.
The solution with the script works very well.

Greetings

Post Reply