Filenames in mail message text

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
3 posts Page 1 of 1

Joerg

Posts: 32
Joined: Wed Dec 19, 2012 9:57 am

Post by Joerg » Tue Dec 17, 2013 2:21 am
Hello,

I try to put a file list into message text. If I use a filelist var I've got the complete path and file name. With a loop I concat the single filenames (name attribut) into a string var. Additional a new line and CR cahr. But if i put this var into my mail message text, there is no CR.

How can I produce a little tab with the filenames within message text?

with regards
Joerg

Jonathan

Posts: 18
Joined: Wed Jan 02, 2013 5:27 am
Location: Mapledurham, UK

Post by Jonathan » Tue Dec 17, 2013 9:28 am
Hi Joerg,

You can try this project, It will loop through the files in a path and return a variable called files which contains all of the files with a tab at the start and CRLF at the end.
Code: Select all
	file.txt
	test.pub
	create.sh
	as2testfile.txt
	files.xml
	Project.log
	list.csv
	testFile.txt
Code: Select all
<project name="Filenames with tabs" mainModule="Main" version="2.0">

	<module name="Main">

		<createFileList fileListVariable="fileList" version="1.0">
			<fileset dir="${path}" />
		</createFileList>

		<forEachLoop itemsVariable="${fileList}" currentItemVariable="thisFile">

			<setVariable name="files" value="${Concat(files,system.tab, String(thisFile:name), system.carriageReturn, system.lineFeed)}" version="2.0" />

		</forEachLoop>

		<sendEmail resourceId="SMTP_Resource" toList="[email protected]" version="2.0">
			<from address="[email protected]" />
			<subject>
				<![CDATA[SOME_SUBJECT]]>
			</subject>
			<message>
				<![CDATA[${files}]]>
			</message>
		</sendEmail>

	</module>

	<variable name="path" value="/home/" description="Path to files" />
	<variable name="files" value="" description="Our list will end up here" />
</project>

Joerg

Posts: 32
Joined: Wed Dec 19, 2012 9:57 am

Post by Joerg » Tue Dec 17, 2013 10:13 am
Hi Jonathan,

many thx, I tried it with '/n' without success.

Your code works and helps.

bye
joerg
3 posts Page 1 of 1