YaRness
11-19-2001, 09:53 AM
is there a vb email object (that comes with VB or somewhere else) that would let you generate an attachment from a string variable (or array of strings or whatever) instead of making you give a path to a filename?
i.e. instead of adding an attachemnt "c:\foo.txt", just use the contents of strFoo and name it "foo.txt".
ChiefRedBull
11-19-2001, 10:39 AM
Im not sure what you mean.....
You want to remove the filepath from an email attachment? So how would the program know where to find it?
Perhaps you just want to include all the text from "c:\foo.txt" in the email? In which case, its a simple case of opening it, reading the contents, and printing them into the body.
Try to explain what you want more clearly. images/icons/smile.gif
Helmar
11-19-2001, 11:06 AM
To my knowledge, an attachment must be a physical file, not some data in memory.
Your only alternative is to create a temporary file with the data from the string variable, attach the file and send the eMail, and then delete the temporary file.
robot313
11-19-2001, 12:31 PM
Or do you mean just the file name for the attachment is in the variable?
YaRness
11-19-2001, 01:10 PM
what i mean is, i have a string "foo" & vbnewline & "bar" & vbnewline... etc.
the user gets an attachment, foo.txt, that reads
<pre>
foo
bar
etc
</pre>
or it could be html or what have you.
i found a code bit on planetsourcecode.com that has the algorithm to encode text into base 64 (the actual function reads in text from a file, but we can bypass that for sure) and the winsock widgets to plug the encoded file into the email message. seems to work. lemme see if i can find it where it was... ah, here: http://www.planetsourcecode.com/xq/ASP/txtCodeId.7519/lngWId.1/qx/vb/scripts/ShowCode.htm.