Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbscript Outlook email

Status
Not open for further replies.

Brenton

Technical User
Jul 29, 2002
43
US
The following is a script I have written to text message me a text files contents. My problem is that my phone doesn't recognize the vbcrlf. Can anyone pleas help.

Dim Filename
Dim FSO
Dim TextStream
Dim file
dim SafeItem, oItem

Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

Filename = "c:\outlook.txt"

set FSO = createObject("Scripting.FileSystemObject")
set file = FSO.GetFile(Filename)
' Open the file
Set TextStream = file.OpenAsTextStream(ForReading, TristateUseDefault)
' Read the file line by line
Do While Not TextStream.AtEndOfStream
Dim StrLine
StrLine = TextStream.readline
' Do something with "Line"
StrLine = StrLine & vbCRLF

Loop

Set TextStream = nothing
Set FSO = nothing

Set objOutlk = createobject("Outlook.Application")
Set objMail = objOutlk.createitem(olMailItem)

set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem

SafeItem.Item = objMail 'set Item property
SafeItem.Recipients.Add "##########@mobile.mycingular.com"
SafeItem.Recipients.ResolveAll
SafeItem.Subject = StrLine
SafeItem.Send
Set Btn = objOutlk.ActiveExplorer.CommandBars.FindControl(1, 7095)
Btn.Execute
set objMail = nothing
set objOutlk = nothing
 
I think the main problem is that you only deal with the VERY LAST line of "c:\outlook.txt" ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top