[indx_exMailClean]

Description

Link: [indx_exMailClean]
Author: Clive Bruton
Category: String
Version: 8.x
License: Public Domain
Posted: May. 20, 2009
Updated: May. 20, 2009
More by this author...

Tag cleans-up an email address string which has extended characters in it Lasso < 8.5 produces an invalid address form when such characters occur and the subsequent email gets stuck in the SMTP queue table. This essentially requires quoting of the "name" portion of the email string, expects an email address in the form: Your Name

Parameters

-mailAddr string, required

Sample Usage

indx_exMailClean(#yourEmailAddress)
indx_exMailClean('Bød Këw <bod@dom.tld>')
indx_exMailClean(-mailAddr='Bød Këw <bod@dom.tld>')
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?lassoscript
	define_tag: 'indx_exMailClean',
		-required = 'mailAddr', -copy,
		-encodenone;
		// use copy just to ensure there is no conflict with another local
		
		/*
			tag cleans-up an email address string which has extended characters in it
			Lasso < 8.5 produces an invalid address form when such characters occur
			and the subsequent email gets stuck in the SMTP queue table
			
			indx_exMailClean(#yourEmailAddress)
			indx_exMailClean('Bød Këw <bod@dom.tld>')			
		*/
		
		if: #mailAddr >> '"';
			// Has quoted text, probably safe
			//#mailAddr += ' has quotes'; // debug line
		else: #mailAddr >> '<' && #mailAddr >> '>';
			// Contains angle brackets
			#mailAddr = output('"', #mailAddr);
			#mailAddr->(replace: '<', '" <');
			//#mailAddr += ' has angle brackets'; // debug line
		/if;
		
		return: #mailAddr;
	
	/define_tag;		
?>

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net