Built-In-Variables...

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
User avatar
Rainer
Normal user
Normal user
Posts: 166
Joined: 2007-06-21 13:40
Location: Zweibrücken - Germany

Built-In-Variables...

Post by Rainer » 2012-11-27 13:56

Hello,

where can I find all the build-in-variables like: %MACRO_FILE% or %MACRO_SENT% or %MACRO_RECIPIENTS%?
Is there a variable for the spamscore?

Kind regards :)
Rainer Noa

ultramedecine
New user
New user
Posts: 11
Joined: 2007-08-24 14:17

Re: Built-In-Variables...

Post by ultramedecine » 2012-12-04 16:47

Hello !

I don't open a new topic for this cause the answer will help me.

My question is : where can i translate the %MACRO_RECIPIENTS% content ?

Thanks and have a nice day :)

User avatar
mattg
Moderator
Moderator
Posts: 20794
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Built-In-Variables...

Post by mattg » 2012-12-05 01:42

I don't know

In the hMailserver Admin GUI
Settings >> Advanced >> Server Messages

you can define what responses your server gives using some of these.
The ones detailed are
%MACRO_FILE%
%MACRO_SENT%
%MACRO_SUBJECT%
%MACRO_RECIPIENTS%
%MACRO_FROM%
%MACRO_TO%

In answer to Rainer...
Can you use the header X-hMailserver-Spam (Boolean) or X-hMailserver-Reason-Score (integer) to achieve what you want?

In answer to ultramedicine...
This will only be recipients that aren't able to be reached, not all recipients.
What exactly are you hoping to do?
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Built-In-Variables...

Post by Bill48105 » 2012-12-07 20:36

I added a new one a few builds back:
* NEW: Added %MACRO_ORIGINAL_HEADER% for ability to include original headers in undeliverable message (UNTESTED - POTENTIAL FOR ISSUES IN RELATED AREAS)

It was quite easy to add so if there was a need for others I could likely add em but they need to be useful enough to warrant the effort. If the info is available at that step in the delivery it should be possible to make a new macro for it.
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

ultramedecine
New user
New user
Posts: 11
Joined: 2007-08-24 14:17

Re: Built-In-Variables...

Post by ultramedecine » 2012-12-10 11:01

mattg wrote: In answer to ultramedicine...
This will only be recipients that aren't able to be reached, not all recipients.
What exactly are you hoping to do?
I am hoping to translate the content.
My (french) users receive for exemple the SEND_FAILED_NOTIFICATION error

Code: Select all

Your message did not reach some or all of the intended recipients.

   Sent: %MACRO_SENT%
   Subject: %MACRO_SUBJECT%

The following recipient(s) could not be reached:

%MACRO_RECIPIENTS%

hMailServer
Ok for translating this part.

But %MACRO_RECIPIENTS% content is :

Code: Select all

myuser@my-domain.fr
   Error Type: SMTP
   Error Description: Message to big
   Additional information: The size of this message exceeded the max message size.
How/where can i translate this content ?

Have a nice day,

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Built-In-Variables...

Post by ^DooM^ » 2012-12-10 12:01

You can't unless you download the source and compile a custom build, it's hard coded.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Built-In-Variables...

Post by Bill48105 » 2012-12-17 22:34

ultramedecine wrote:
But %MACRO_RECIPIENTS% content is :

Code: Select all

myuser@my-domain.fr
   Error Type: SMTP
   Error Description: Message to big
   Additional information: The size of this message exceeded the max message size.
How/where can i translate this content ?

Have a nice day,
You do realize the 'Additional information' string is provided by the receiving server that rejected the email right? In other words THEY define the string not hmail so you have no control over what language it is.. Any more than if you called up someone in another county on the telephone. :D

It is true though that some SMTP response strings are hard coded but the ones you gave are NOT hmail strings. An example string that is hard-coded in hmail would be:

Code: Select all

552 Message size exceeds fixed maximum message size. Size: %d KB, Max size: %d KB
But if your mail server is trying to send an email & it is rejected by another server hmail will show you THEIR reason strings in THEIR language. (Pretty sure mail response strings are supposed to be in English though.)

About all I can imagine you could do is run the messages thru a translator if you want remote strings non-english or as mentioned if you want your strings to be different you'd need to edit the source & compile hmail.
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

xpunac
Normal user
Normal user
Posts: 51
Joined: 2012-11-02 09:45

Re: Built-In-Variables...

Post by xpunac » 2013-03-24 02:45

^DooM^
You can't unless you download the source and compile a custom build, it's hard coded.
Where can i find the source of variables in the source code, witch i downloaded?
Where source is of this variables?:

Code: Select all

%MACRO_FILE%
%MACRO_SENT%
%MACRO_SUBJECT%
%MACRO_RECIPIENTS%
%MACRO_FROM%
%MACRO_TO%
Thanks in advance!

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Built-In-Variables...

Post by Bill48105 » 2013-03-24 07:24

xpunac wrote:
^DooM^
You can't unless you download the source and compile a custom build, it's hard coded.
Where can i find the source of variables in the source code, witch i downloaded?
Where source is of this variables?:

Code: Select all

%MACRO_FILE%
%MACRO_SENT%
%MACRO_SUBJECT%
%MACRO_RECIPIENTS%
%MACRO_FROM%
%MACRO_TO%
Thanks in advance!
You took the time to download the source but did you bother to SEARCH the source code for those strings? lol They are in PersistentMessage.cpp, VirusScanner.cpp & SMTPVirusNotifier.cpp.

What is it you are trying to accomplish?
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

xpunac
Normal user
Normal user
Posts: 51
Joined: 2012-11-02 09:45

Re: Built-In-Variables...

Post by xpunac » 2013-03-25 02:23

My idea is to modify %MACRO_SUBJECT%.
Example:

Code: Select all

Original %MACRO_SUBJECT%:

   Error Type: SMTP
   Remote server (74.125.143.26) issued an error.
   hMailServer sent: .
   Remote server replied: 552 5.7.0 review our attachment guidelines. a6si4136079lbz.78 - gsmtp

Modified %MACRO_SUBJECT%:

   Error Type: SMTP
   Remote server (74.125.143.26) issued an error.
   Remote server replied: 552 5.7.0 review our attachment guidelines. a6si4136079lbz.78 - gsmtp


Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Built-In-Variables...

Post by Bill48105 » 2013-03-25 15:49

xpunac wrote:My idea is to modify %MACRO_SUBJECT%.
Example:

Code: Select all

Original %MACRO_SUBJECT%:

   Error Type: SMTP
   Remote server (74.125.143.26) issued an error.
   hMailServer sent: .
   Remote server replied: 552 5.7.0 review our attachment guidelines. a6si4136079lbz.78 - gsmtp

Modified %MACRO_SUBJECT%:

   Error Type: SMTP
   Remote server (74.125.143.26) issued an error.
   Remote server replied: 552 5.7.0 review our attachment guidelines. a6si4136079lbz.78 - gsmtp

You do realize subject is single line right? The only thing I see different in your before & after is missing the "hMailServer sent: ." line missing. What's the point in doing that?
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

xpunac
Normal user
Normal user
Posts: 51
Joined: 2012-11-02 09:45

Re: Built-In-Variables...

Post by xpunac » 2013-03-25 20:11

Bill48105
You do realize subject is single line right? The only thing I see different in your before & after is missing the "hMailServer sent: ." line missing. What's the point in doing that?
I do not know, I was thinking that if I can change, I can change the whole scenario of %MACRO_SUBJECT%.
I'm just curious :)

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Built-In-Variables...

Post by Bill48105 » 2013-03-25 22:12

xpunac wrote:
Bill48105
You do realize subject is single line right? The only thing I see different in your before & after is missing the "hMailServer sent: ." line missing. What's the point in doing that?
I do not know, I was thinking that if I can change, I can change the whole scenario of %MACRO_SUBJECT%.
I'm just curious :)
The macro stuff is pretty trivial in the code but care needs to be taken to only do valid things. ;) Is partly why I was wondering what you were trying to accomplish to know if reasonable or possible before you wasted time on it.
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

xpunac
Normal user
Normal user
Posts: 51
Joined: 2012-11-02 09:45

Re: Built-In-Variables...

Post by xpunac » 2013-03-26 17:56

Bill48105
The macro stuff is pretty trivial in the code but care needs to be taken to only do valid things. ;) Is partly why I was wondering what you were trying to accomplish to know if reasonable or possible before you wasted time on it.
No, I will not go into programming adjustments, just ask out of interest.
I understand, thank you Bill48105

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Built-In-Variables...

Post by Bill48105 » 2013-03-26 23:04

xpunac wrote:
Bill48105
The macro stuff is pretty trivial in the code but care needs to be taken to only do valid things. ;) Is partly why I was wondering what you were trying to accomplish to know if reasonable or possible before you wasted time on it.
No, I will not go into programming adjustments, just ask out of interest.
I understand, thank you Bill48105
You can always put in feature request & people can vote. For some things I just go ahead & make the changes if it fixes a bug or seems important enough. But again you've not really stated why you want/need it so not really making your case. ;)
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

xpunac
Normal user
Normal user
Posts: 51
Joined: 2012-11-02 09:45

Re: Built-In-Variables...

Post by xpunac » 2013-03-28 16:00

It's nice to have more options.
For example, in GUI interface has option to change %MACRO_SUBJECT% and another variables.
Good for administrators.
The more options for changing the designers, the nicer it.

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Built-In-Variables...

Post by Bill48105 » 2013-03-28 20:33

xpunac wrote:It's nice to have more options.
For example, in GUI interface has option to change %MACRO_SUBJECT% and another variables.
Good for administrators.
The more options for changing the designers, the nicer it.
There are many things that'd be nice but not enough time to get to them all. ;) Besides, many times too many options are bad too since people get confused or use them improperly causing problems.
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

User avatar
mattg
Moderator
Moderator
Posts: 20794
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Built-In-Variables...

Post by mattg » 2013-03-29 06:15

And more options makes for a slower program
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Post Reply