Problem form sending a document via Mail

Hello, My problem is the mail is send but no document

contenu = "Rapport Table Palette "
filepath = "C:\CSV\Export\\test.txt"
filename = "test.txt"
filedata = system.file.readFileAsBytes(filepath)
titre = "b"
A_qui = ["my.mail@compagnie.com"]
system.net.sendEmail(smtpProfile="MailTerreal",fromAddr="ivan.gnition@compagnie.com",to=A_qui,body=contenu,subject=titre,attachmentNames=filename,attachmentData=filedata)

Sorry for my bad english
Best Regard
Etienne DELAFOLIE

You need to double your first two backslashes, I think.

(Microsoft's choice of the backslash for folder separators was just plain stupid, IMNSHO, as all major programming languages use it as an escape character for control codes. Even Microsoft's own languages.)

4 Likes

Also, I think these need to be lists. Like so:

attachmentNames=[filename],attachmentData=[filedata]
3 Likes