hello all,
although i'm not familiar with vbs, i was asked to create a script which will do the following: 1. change the extension of a document to .txt,
2. open the file,
3. read the lines and find an e-mail address,
4. create a new e-mail with Notes and attach the file,
5. send it to the e-mail address.
how much of these can be done with vbs? how can it be done?
I'd really appreciate your help..
thanks in advance!
gulsh
2 2125
Hi the first thing to do is take a look at filesystemobject
Then look for lotus notes automation
Hi there
Try this out !
Put Your mail adresses in a file called 'maillist', and place it in C:\
The file could look like this: john@doe.com jane@doe.com
Then open an empty vbs-file, then copy and paste the lines below ino the file: - 'Script start
-
Set notessession = CreateObject("Notes.Notessession")
-
Set notesdb = notessession.GetDatabase("", "")
-
Call notesdb.OPENMAIL
-
-
set fso = WScript.CreateObject("Scripting.FileSystemObject")
-
-
' path1 is Your input file and path2 is the name with the txt extension
-
-
path1 = "C:\maillist"
-
path2 = "C:\maillist.txt"
-
-
' copy the file
-
fso.CopyFile path1 , path2, true
-
WScript.Sleep 1000
-
-
' delete Your input file
-
fso.DeleteFile path1
-
-
' get and open Your mail-address file
-
Set ifile = fso.GetFile("c:\maillist.txt")
-
Set infil = ifile.OpenAsTextStream
-
-
Do until eof
-
' read a line/mail-address from the file
-
mailadr = infil.readline
-
-
' if nothing is read, then its EOF, so leave the loop
-
If mailadr = "" then
-
exit do
-
End if
-
-
'MsgBox (mailadr)
-
-
'Make new mail message
-
Set notesdoc = notesdb.CreateDocument
-
notesdoc.Form = "Memo"
-
-
' Set up the recipients
-
Call notesdoc.ReplaceItemValue("Sendto", mailadr)
-
'Call notesdoc.ReplaceItemValue("CopyTo", mailadr)
-
'Call notesdoc.ReplaceItemValue("BlindCopyTo", mailadr)
-
-
'The subject of the mail
-
subj = "TEST MAIL " & mailadr
-
-
-
' setup three text blocks - note that we use VBCRLF to make the carrige return, line feed
-
mailtxt = "Test mail"
-
-
mailtxt1 = "Hello" & reg
-
-
mailtxt2 = "Here is Your mail"
-
mailtxt2 = mailtxt2 & VBCRLF
-
mailtxt2 = mailtxt2 & "Below You will fin a link to google" & VBCRLF
-
mailtxt2 = mailtxt2 & VBCRLF
-
mailtxt2 = mailtxt2 & "Link:" & VBCRLF
-
mailtxt2 = mailtxt2 & "http://www.google.com" & VBCRLF
-
mailtxt2 = mailtxt2 & "" & VBCRLF
-
mailtxt2 = mailtxt2 & "" & VBCRLF
-
mailtxt2 = mailtxt2 & "Regards" & VBCRLF
-
mailtxt2 = mailtxt2 & "John Doe" & VBCRLF
-
-
Call notesdoc.ReplaceItemValue("Subject", subj)
-
Set notesrtf = notesdoc.CreateRichTextItem("body")
-
-
'put the three text blocks in the body of the mail - note that we use AddNewLine to make som space between the blocks
-
Call notesrtf.AppendText(mailtxt)
-
Call notesrtf.AddNewLine(2)
-
-
Call notesrtf.AppendText(mailtxt1)
-
Call notesrtf.AddNewLine(2)
-
-
Call notesrtf.AppendText(mailtxt2)
-
Call notesrtf.AddNewLine(2)
-
-
notesdoc.SaveMessageOnSend = 1
-
-
' You can also attach a file
-
Call notesrtf.EmbedObject(1454, "", "C:\maillist.txt")
-
-
'Send message
-
notesdoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
-
Call notesdoc.Send(False)
-
-
loop
-
-
Set fso = Nothing
-
Set notessession = Nothing
-
MsgBox ("Mail send")
-
'Script End
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tom Brown |
last post by:
Hi,
I have what seems to be a simple problem. But I can not for the life of me
find a way to send an integer over a socket. The send method will only accept
strings. Here is what I am trying to...
|
by: Etienne Charland |
last post by:
Hi, there is an application running on a remote desktop (under Citrix ICA,
but the same problem applies for RDC or PC Anywhere). Now, I want to send
keys to the remote application from a local app....
|
by: Pete Loveall |
last post by:
I have a server application that monitors a private local queue for
messages. The message sent to it has a label and a response queue defined.
It works correctly when the queue is accessed via...
|
by: Kitchen Bin |
last post by:
Hi.
I am trying to use Sockets to do multiple Send and Receives via HTTP
(not simultaneously). A first pair of Send/Receives works fine and
sure enough I receive HTML back, but the next...
|
by: zhimin |
last post by:
Hi,
I'm writing a program to send large file(100m) through dotnet using
TCPListener & TCPClient, I'm sending the file with a ask and response loop:
1. Client send a flag 1 to server indicate it...
|
by: GrantS |
last post by:
I need to use a sendkeys key combination to automate the "accept
files" that a remote user wants to send to me via Windows messenger. I
am using automation to work with Windows Messenger client in...
|
by: Sara |
last post by:
HI,
I want to code a program to detect GSM mobile (any kind) which connected
through serial port to computer and then be able to send SMS through
this mobile phone to other mobile phones, could...
|
by: Hasan O |
last post by:
hi , I have a problem with socket.send
mesajlar = Encoding.ASCII.GetBytes("UGIR");
socketResultValue = socket.Send(mesajlar,0,mesajlar.Length,
SocketFlags.None);
socketResultValue =...
|
by: ultr |
last post by:
Hello,
I have read that send() may not send whole message and returns the
nuber of bytes sent, so that we can handle the rest of the message. Is
it true, because i have tested sending even 1MB...
|
by: Xionbox |
last post by:
Hello everybody,
The error I have seems very easy to solve, but for some odd reason I can't seem to solve it. Anyways, here's my "setup".
I created a server running on localhost:1200 (telnet...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |