|
Hi,
I am trying to send an email using VBScript. I have managed to write code to send the email, and include an attachment. I have currently got the following vbs code:
______________________________________________
Dim objOutlook
Dim objOutlookMsg
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
With objOutlookMsg
.To = "Recipient Name"
.Cc = " "
.Subject = "Updates Notification"
.Body = vbCrLf & "The documents listed in the attached text file have recently been updated" & vbCrLf & vbCrLf
' .HTMLBody = "HTML version of message"
.Attachments.Add ("C:\Update Notification\Text.txt")
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
_____________________________________________
Now, I am trying to put the contents of the text file into the body of the email (instead of attaching the text file into the email)
If viable, anyone know how to do it?
Any help will be much appreciated....thanks!!
|
|
|
|
|
Easy. Use a FileSystemObject to OpenTextFile. This will return a TextStream object. Use the ReadAll method to read the contexts of the file into a variable, then close the file. Tthen you just append the contents of the variable to the Body of the message.
ReadAll Method[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Thanks alot for the help....much appreciated!!
Read the link you put in the reply.
Now have the following code, which does the trick:
_________________________________________________
Function ReadTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f, Msg
Set fso = CreateObject("Scripting.FileSystemObject")
' Set f = fso.OpenTextFile("C:\Update Notification Code\Text.txt", ForWriting, True)
' f.Write "Hello world!"
Set f = fso.OpenTextFile("C:\Update Notification Code\Text.txt", ForReading)
ReadTextFileTest = f.Read(9999)
End Function
Dim objOutlook
Dim objOutlookMsg
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
With objOutlookMsg
.To = "Email Address"
.Cc = ""
.Subject = "Update Notification"
.Body = vbCrLf & "The documents listed below have recently been updated:" & vbCrLf & vbCrLf & ReadTextFileTest & vbCrLf
.Importance = 2 '0 = low, 1 = normal, 2 = High importance
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
_________________________________________________
Any ideas on how to make it more efficient?
Thanks alot once again.
|
|
|
|
|
Un-Connected wrote:
Any ideas on how to make it more efficient?
What do you mean by "more efficient"?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi all,
i need to view a html(say abc.html) in my form and compare it to another html . both these should be placed side-by-side. i need to add synchronized scrolling to these.
any inputs?
thanks
|
|
|
|
|
Using VS.net 2005, the PictureBox in WinForm could not show pictures.
Why?
|
|
|
|
|
rushing wrote:
Using VS.net 2005, the PictureBox in WinForm could not show pictures.
Why?
Can you be more descriptive please. If I asked they question "Using Toyota Yaris, the engine won't start. Why?" how much of a useful response do you think I will get.
What code are you using to try and display the pictures?
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
1 Create a project
2 Using a winform
3 drag a picturebox to the winform
4 select the picturebox
5 select the property of image
6 select a jpg or bmp file for the picturebox
7 nothing happened , picture could not be seen
8 that's all
|
|
|
|
|
I try to run SQL statement in by OleDbCommand , the database is Oracle 9i.
However, some error occurs(ORA-00911).
Here is the sourcecode:
Dim ConnString As String
ConnString = "Provider=msdaora;Data Source =" + Server + ";User ID=" + User + ";Password=" + Password + ";"
Dim oCn As New OleDbConnection
Try
oCn.ConnectionString = ConnString
oCn.Open()
If oCn.State = Data.ConnectionState.Open Then
Dim oCmd As New OleDbCommand
oCmd.Connection = oCn
'CreateProgramManager(oCmd)
strSQL = "CREATE USER ""PRGM_MNGR"" " + _
"PROFILE ""DEFAULT"" " + _
"IDENTIFIED BY ""xxxx"" " + _
"DEFAULT TABLESPACE ""PROGRAM"" " + _
"TEMPORARY TABLESPACE ""TEMP"" " + _
"ACCOUNT UNLOCK; "
strSQL = LTrim(strSQL)
'MsgBox(strSQL)
oCmd.CommandText = strSQL
oCmd.ExecuteNonQuery()
|
|
|
|
|
|
|
Now I want to create a toolbar or menubar likes office2003's,and I have done parts of it,but parts of it I couldn't do.
Anyone has the sourcecode of it or can do it,please post it to my E-Mail or tell me how to do it .Thank you!
|
|
|
|
|
Noone is just going to give you the source code for an entire toolbar or menubar. We will help you with YOUR code, but you haven't asked us any questions about any problems your having.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The problem of me is that I couldn't redraw the menubar,because the mainmenu is made up of menuitems,I couldn'd measure the size of the top rectangle the mainmenu located at, so I cann't draw the office2003 menubar color on the top of the form.
|
|
|
|
|
dyh2222 wrote:
because the mainmenu is made up of menuitems
You expected something different?
dyh2222 wrote:
I couldn'd measure the size of the top rectangle the mainmenu located at
Why would you want to?
dyh2222 wrote:
so I cann't draw the office2003 menubar color on the top of the form
I take it your trying to ownerdraw the entire Office 2003 menu bar?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Structures support event handlings ?
|
|
|
|
|
How to create Shared Procedures, Static procedures, Shared Properties, Shared events. An example will be very much appreciated
|
|
|
|
|
Public Shared Sub SubNameHere
End Sub
Public Shared Function FuncNameHere
End Function
Public Shared Event EventNameHere()
Public Property NameOfProp()
Get
End Get
Set(ByVal Value)
End Set
End Property
Public Structure StructureName
Dim TestStructure As String
End Structure
Not sure on the static
hope that is what you meant
"If i was king cigarettes would be free."
|
|
|
|
|
How to work on multiple columns in a listbox? Let say, I want two columns, Name and Roll should be displayed two columns in the listbox, values are stored in the database "student".
|
|
|
|
|
Apparently, I read recently that .NET does not support multiple columns in a listbox. I was trying to accomplish the same thing when I read about the this.
|
|
|
|
|
But there is a property Multicolumn with Listbox.
What is this ??
|
|
|
|
|
Sorry, my mistake. I was thinking of the combobox.
|
|
|
|
|
Suppose a Base Class C1, another class C2 inhriting C1, an other class C3 inheriting Class C2. I want to call instance constructor of class C1 into constructor of class C3
|
|
|
|
|
How can we reflect a dataset after altering the table. The generation of a new dataset is not working.
(I tried with MSAccess database)
|
|
|
|
|
How to change the column name of Datagrid from the default column name of the database to any other. Let say, the column name in the database in "Emp_name", and I want to change it
on the datagrid to show as "Employee Name"
Suman Singh
|
|
|
|