<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title>www.ritlabs.com [Topic: How to check recipient domain to do something in macro]</title>
		<link>http://www.ritlabs.com</link>
		<description>New posts in How to check recipient domain to do something in macro of  forum at www.ritlabs.com [www.ritlabs.com]</description>
		<language>en</language>
		<docs>http://backend.userland.com/rss2</docs>
		<lastBuildDateTag>Tue, 05 Mar 2019 20:27:49 +0200</lastBuildDateTag>		<item>
			<title>How to check recipient domain to do something in macro</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum6/topic13694/message46868/">How to check recipient domain to do something in macro</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum6/">The Bat! - Templates and Macros</a>. <br />
			Thanks a bunch for sharing such a detailed explanation. Many of us struggle with regex and your post will be undoubtedly helpful. I'm copying it for possible future use. <br /><br />regards,<br />david <br />
			<i>05 March 2019 20:27:49, <a href="http://www.ritlabs.com/en/forums/">david kirk</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum6/topic13694/message46868/</link>
			<guid>http://www.ritlabs.com/en/forums/forum6/topic13694/message46868/</guid>
			<pubDate>Tue, 05 Mar 2019 20:27:49 +0200</pubDate>
			<category>The Bat! - Templates and Macros</category>
		</item>
		<item>
			<title>How to check recipient domain to do something in macro</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum6/topic13694/message46866/">How to check recipient domain to do something in macro</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum6/">The Bat! - Templates and Macros</a>. <br />
			Heya David,<br /><br />luck was what I needed. I had tried unsuccessfully to get it working for maybe one hour, before posting my question. I tried again, and this time (after another hour) IT WORKS.<br /><br />The trouble was not the regex search pattern. Not because I'm such a genius, but because I could google for it. The problem that took me so long was getting the macro to take the regex result of search in the email for the domain.<br /><br />I did not understand how to do that, but by first trying the appealing versions and then the weird versions (from my inexperienced point of view) I stumbled over the right one that works. I always thought that the &quot;%REGEXPMATCH=%TOADDR&quot; bit would get the domain string and I would use the %REGEXPMATCH then again in the IF part, you know like a system variable. Like so:<br /><br /><span class="bx-font" style="font-family:monospace">%IF:&quot;%REGEXPMATCH&quot;=&quot;@example.com&quot;:</span><br /><span class="bx-font" style="font-family:monospace"> &nbsp; &nbsp;^^^^^^^^^^^^^^ thought this would BE the regex result, and IF it's the correct domain it would be like</span><br /><span class="bx-font" style="font-family:monospace"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;@example.com&quot; = &quot;@example.com&quot; -&gt; TRUE</span><br /><br />Didn't work. Only when I used that full code piece in the IF part, it worked.<br /><br />the working part results (I think) from the macro's POV in:<br /><br />CODE: <br /><br />%IF:&quot;%REGEXPMATCH=%TOADDR&quot;=&quot;@example.com&quot;:<br /><br />BECOMES with the wanted domain: <br />%IF:&quot;@example.com&quot;=&quot;@example.com&quot;: &nbsp; --&gt; TRUE<br />OR<br />%IF:&quot;@wrongdomain.fr&quot;=&quot;@example.com&quot;: &nbsp; --&gt; FALSE<br /><br />Learned something about TB macros, and I hope I will remember it at the next time I'll try do something nifty.<br /><br /><br />So this I just put at the beginning of the template, this is the regex part 1 - setting the pattern<br />
====code====
<pre>%SETPATTREGEXP="@(.*)$"%-</pre>
=============
to see what regex actually finds (not needed after one knows that part works), it outputs what the regex sees as the domain part in the TO field:<br />
====code====
<pre>--&#62;%REGEXPMATCH=%TOADDR&#60;--
</pre>
=============
<p>then here comes the thing that does the magic:<br /></p>
====code====
<pre>%IF:"%REGEXPMATCH=%TOADDR"="@example.com":%SUBJECT="insertyourtext - %SUBJECT"%-
</pre>
=============
The %SUBJECT=&quot;insertyourtext - %SUBJECT&quot;%- prevents the deletion of whatever text one was typing when going through the header fields in a new mail.<br /><br />So one has to type into that macro the &quot;example.com&quot; domain and the text (like in my case my customer ID) at &quot;insertyourtext&quot;.<br /><br />all this I have put into my macro that gets started when I open a new message window.<br /><br /><br /><br />sorry for the very long entry for a very short solution.<br /><br /><br /><br /><br />cheers,<br />Jürgen <br />
			<i>04 March 2019 22:03:35, <a href="http://www.ritlabs.com/en/forums/">Jurgen Haug</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum6/topic13694/message46866/</link>
			<guid>http://www.ritlabs.com/en/forums/forum6/topic13694/message46866/</guid>
			<pubDate>Mon, 04 Mar 2019 22:03:35 +0200</pubDate>
			<category>The Bat! - Templates and Macros</category>
		</item>
		<item>
			<title>How to check recipient domain to do something in macro</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum6/topic13694/message46858/">How to check recipient domain to do something in macro</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum6/">The Bat! - Templates and Macros</a>. <br />
			I cannot provide the answer, Jurgen, but regex may be your solution. I use regex is quite simple processes, but what you're seeking is the ability to have the data to left of @ ignored when comparing against the target domain. There is a TB!-oriented page on macros and regex at <noindex><a href="http://www.silverstones.com/thebat/tbfaq.html" target="_blank" rel="nofollow">http://www.silverstones.com/thebat/tbfaq.html</a></noindex> which may prove helpful. If you do figure it out, I would appreciate seeing your solution, as it would help others, I'm sure. Good luck. <br /><br />david <br />
			<i>03 March 2019 16:10:21, <a href="http://www.ritlabs.com/en/forums/">david kirk</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum6/topic13694/message46858/</link>
			<guid>http://www.ritlabs.com/en/forums/forum6/topic13694/message46858/</guid>
			<pubDate>Sun, 03 Mar 2019 16:10:21 +0200</pubDate>
			<category>The Bat! - Templates and Macros</category>
		</item>
		<item>
			<title>How to check recipient domain to do something in macro</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum6/topic13694/message46836/">How to check recipient domain to do something in macro</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum6/">The Bat! - Templates and Macros</a>. <br />
			Hi there,<br /><br />I have this macro, that checks with a New Mail, if it goes to a certain recipient. If so it adds my customer ID into the subject.<br /><br />&gt;&gt;&gt; %IF:&quot;%TOADDR&quot;=&quot;<noindex><a href="mailto:FirstName.LastName@domain.de" target="_blank" rel="nofollow">FirstName.LastName@domain.de</a></noindex>&quot;:%SUBJECT=&quot;N123456 - &quot;%-<br />It works like a charm, but I would like to just check for the DOMAIN, so that it does this with all recipients of that company. How do I do that? <br /><br />I tried %IF:&quot;%TOADDR&quot;=&quot;<noindex><a href="mailto:FirstName.LastName@domain.de" target="_blank" rel="nofollow">@domain.de</a></noindex>&quot; but certainly it wasn't that easy <img src="http://www.ritlabs.com/bitrix/images/main/smiles/5/icon_wink.gif" border="0" data-code=";-)" data-definition="SD" alt=";-)" style="width:16px;height:16px;" title="" class="bx-smile" /><br /><br />regards,<br />Jürgen <br />
			<i>26 February 2019 17:15:40, <a href="http://www.ritlabs.com/en/forums/">Jurgen Haug</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum6/topic13694/message46836/</link>
			<guid>http://www.ritlabs.com/en/forums/forum6/topic13694/message46836/</guid>
			<pubDate>Tue, 26 Feb 2019 17:15:40 +0200</pubDate>
			<category>The Bat! - Templates and Macros</category>
		</item>
	</channel>
</rss>
