Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 18th, 2006, 01:15 PM
Stefan Dase
Guest
 
Posts: n/a
Default Problems with getting file text stream

Hello everybody!

I'm not very experienced in ASP but have to extend a colleague's site.

One page enables users to add new action-items to our database. After
inserting the record it have to send an email to the responsible worker
with title and description.

I tried to read the message body from a template text file (*.htm) and
substitute placeholders with the new data. But I only get an empty
message body. Here is the relevant part of ASP code:

'get email message from template
sTmplt = Server.MapPath("../templates/actionitem_email.htm")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(sTmplt) Then
sMgs = objFSO.OpenTextFile(sTmplt).ReadAll
Else
sMsg = "File not found: " & sTmplt
End If

vEmail = rstRecipient.Fields(0).Value
If Not IsNull(vEmail) Then
With objMail
.From = "bedabal@luerssen.de"
.Subject = "Neue Aufgabe in BeDaBaL für Projekt " & sProjectName
.To = vEmail
.TextBody = sMsg
.Send
End With
End If

If i fill sMsg manually with some characters they appear in the email.
But if I try to read out the template there is no text, even the Else
branch isn't used.

Do anybody has any idea?

Many thanks,
Stefan
  #2  
Old December 18th, 2006, 01:55 PM
Stefan Dase
Guest
 
Posts: n/a
Default Re: Problems with getting file text stream

Ups,

sometimes it is very helpfull to have a little break. It was just the
wrong notation:
Quote:
If objFSO.FileExists(sTmplt) Then
sMgs = objFSO.OpenTextFile(sTmplt).ReadAll
^
Quote:
Else
sMsg = "File not found: " & sTmplt
End If
Thank you,
Stefan
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles