<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>MachForm Community Forums Topic: Conditional Emailing based on Country Field</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Conditional Emailing based on Country Field</description>
<language>en</language>
<pubDate>Mon, 04 May 2026 04:01:49 +0000</pubDate>

<item>
<title>redityo on "Conditional Emailing based on Country Field"</title>
<link>https://www.machform.com/forums/topic/conditional-emailing-based-on-country-field#post-3919</link>
<pubDate>Mon, 08 Dec 2008 01:05:55 +0000</pubDate>
<dc:creator>redityo</dc:creator>
<guid isPermaLink="false">3919@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;Do you mean country field is Address field ? or drop down with country data ? we have similar post with this, you can find in here :&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.appnitro.com/forums/topic/email-from-a-drop-downlist?replies=9#post-2601&#34; rel=&#34;nofollow&#34;&#62;http://www.appnitro.com/forums/topic/email-from-a-drop-downlist?replies=9#post-2601&#60;/a&#62; &#60;/p&#62;
&#60;p&#62;however you still need to change the form id and field/element id, depending on which field will become the conditional field. Here is the magic code :)&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function form18_hook_email($params){

	//change the email addresses below
	$email_list[1] = &#38;#39;sales@example.com&#38;#39;;
	$email_list[2] = &#38;#39;hrd@example.com&#38;#39;;
	$email_list[3] = &#38;#39;support@example.com&#38;#39;;
	$email_list[4] = &#38;#39;accounts@example.com&#38;#39;;
	$email_list[5] = &#38;#39;legal@example.org&#38;#39;; 

	$res = do_query(&#38;quot;select element_3 from ap_form_{$params[&#38;#39;form_id&#38;#39;]}
where id=&#38;#39;{$params[&#38;#39;entry_id&#38;#39;]}&#38;#39;&#38;quot;);
	$row = do_fetch_result($res);

	$attn = $row[&#38;#39;element_3_6&#38;#39;];

	$target_email = $email_list[$attn];

	if(!empty($target_email)){
		return $target_email;
	}else {
		return true;
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;if you use address field and get  the condition from country data, you should change the array index. Since address is a sub field (sub 6) and not using numeric data, the change should be like this :&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function form18_hook_email($params){

	//change the email addresses below
	$email_list[&#38;#39;Berlin&#38;#39;] = &#38;#39;sales@example.com&#38;#39;;
	$email_list[&#38;#39;Albania&#38;#39;] = &#38;#39;hrd@example.com&#38;#39;;
	$email_list[&#38;#39;Argentina&#38;#39;] = &#38;#39;support@example.com&#38;#39;;
	$email_list[&#38;#39;Italy&#38;#39;] = &#38;#39;accounts@example.com&#38;#39;;

	$res = do_query(&#38;quot;select element_3_6 from ap_form_{$params[&#38;#39;form_id&#38;#39;]}
where id=&#38;#39;{$params[&#38;#39;entry_id&#38;#39;]}&#38;#39;&#38;quot;);
	$row = do_fetch_result($res);

	$attn = $row[&#38;#39;element_3&#38;#39;];

	$target_email = $email_list[$attn];

	if(!empty($target_email)){
		return $target_email;
	}else {
		return true;
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You can see the element have sub id = 6 (element_3_6)
&#60;/p&#62;</description>
</item>
<item>
<title>ricksterv4n1x8 on "Conditional Emailing based on Country Field"</title>
<link>https://www.machform.com/forums/topic/conditional-emailing-based-on-country-field#post-3916</link>
<pubDate>Sat, 06 Dec 2008 23:29:32 +0000</pubDate>
<dc:creator>ricksterv4n1x8</dc:creator>
<guid isPermaLink="false">3916@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I have a country field in all of our forms. Depending on which country the user selects I would like to send the form to a different recipient. I would like to define the email addresses for each possible country and have the form send based on that. Do you see this as possible? Thanks!
&#60;/p&#62;</description>
</item>

</channel>
</rss>
