|
-
Aug 6th, 2001, 02:26 PM
#1
Thread Starter
Hyperactive Member
Outlook...
Hi,
Can anybody give me a code how to do this:
Catch all emails adressers from outlook.
Sent to all catched emails message with app.exe
Can anybody help me???
Please.
-
Aug 6th, 2001, 04:24 PM
#2
Frenzied Member
You can use CDONTS. Go to www.wrox.com and do a search for CDONTS and download the code for this book. That has plenty of samples.Hope that it helps.
-
Aug 6th, 2001, 04:59 PM
#3
Fanatic Member
'This will work to get all addresses - reference Outlook 8 or 9
Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim adl As Outlook.AddressList
Dim ade As Outlook.AddressEntry
Dim aPAB() As Variant
Dim i As Integer
ReDim aPAB(100, 2)
Set ol = New Outlook.Application
Set ns = ol.GetNamespace("MAPI")
'Return the at home personal address book.
Set adl = ns.AddressLists("Contacts")
'This should work from work
'Set adl = ns.AddressLists("Personal Address Book")
'Loop through all entries in the PAB
' and fill an array with some properties.
For Each ade In adl.AddressEntries
'Display name in address book.
aPAB(i, 0) = ade.Name
'Actual e-mail address
aPAB(i, 1) = ade.Address
'Type of address ie. internet, CCMail, etc.
aPAB(i, 2) = ade.Type
i = i + 1
Next
ReDim aPAB(i - 1, 2)
Set ol = Nothing
Set ns = Nothing
Set adl = Nothing
==============
' to send a mail
Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim newMail As Outlook.MailItem
Set ol = New Outlook.Application
'Return a reference to the MAPI layer.
Set ns = ol.GetNamespace("MAPI")
ns.Logon
'Create a new mail message item.
Set newMail = ol.CreateItem(olMailItem)
With newMail
'Add the subject of the mail message.
.Subject = "blah blah blah"
'Create some body text.
.Body = "blah blah blah"
'Add a recipient and CC and test to make sure that the
'addresses are valid using the Resolve method.
With .Recipients.Add("[email protected]")
.Type = olTo
If Not .Resolve Then
MsgBox "Unable to resolve address: TO", vbInformation
Exit Sub
End If
End With
With .Recipients.Add("[email protected]")
.Type = olCC
If Not .Resolve Then
MsgBox "Unable to resolve address: CC", vbInformation
Exit Sub
End If
End With
'Attach a file as a link with an icon.
With .Attachments.Add("c:\autoexec.bat")
.DisplayName = "Training info"
End With
'Send the mail message.
.Send
End With
ns.Logoff
'Release memory.
Set ol = Nothing
Set ns = Nothing
Set newMail = Nothing
HTH
John
-
Aug 7th, 2001, 03:20 AM
#4
Thread Starter
Hyperactive Member
Patoooey, sorry, but you code does not work. I'm using Outlook v. 9. If not hard please make a form which demonstates this code.
Thank you.
-
Aug 7th, 2001, 07:29 AM
#5
Fanatic Member
Making a Form won't help you. That code is taken from an Outlook class I have which uses no forms. There are no controls or visual aids for this code. All work is done with the Outlook 9.0 Object model behind the scenes.
When you say it doesn't work, what is it doing or saying ??
I need exact error messages in order to help.
John
-
Aug 7th, 2001, 02:00 PM
#6
Thread Starter
Hyperactive Member
I wanted olny a demo project which demonstrates that code. I inserted this code to Form_Load section and it didn't worked, so I want an example.
-
Aug 7th, 2001, 04:31 PM
#7
Fanatic Member
Create a new form. Place 1 commandbutton on it. Place the Send Mail code in the click event. You then need to actually look at the code and make the changes you want. Mail Address, Subject, Mail Body, etc. When you click the button, mail should be sent to the address you specify.
As far as the Address code.....what you do with the array of addresses is up to you. My creating a form won't help you.
You are referencing Outlook 8 or 9 right ???
Again.....what is the error ? Outlook/VB always give an error message.
John
-
Aug 8th, 2001, 12:55 AM
#8
Thread Starter
Hyperactive Member
The error is in Dim ol As Outlook.Application - Compile Error: User defined type not defined.
I'm using Outlook 9
What is the problem?
-
Aug 8th, 2001, 01:03 AM
#9
Junior Member
might help ?
confused:
Perhaps, er, , Outlook object library might need to be referenced ?...confused:
-
Aug 8th, 2001, 03:49 AM
#10
Retired VBF Adm1nistrator
Norkis, are you trying to write a virus ?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 8th, 2001, 04:01 AM
#11
Fanatic Member
Nice one Jamie, I had the same thought....
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Aug 8th, 2001, 04:04 AM
#12
Retired VBF Adm1nistrator
Though it could in theory be totally legit.
Doubt it tho
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 8th, 2001, 04:11 AM
#13
Fanatic Member
Yeah I mean :
He could be collecting everyones email addresses to make a nice e-collage or something like that for Tony Hart's gallery.......or could he...?
*cue the hooded claw*
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Aug 8th, 2001, 05:53 AM
#14
Fanatic Member
If he can't figure out how to reference a library, then creating a virus is not in his tool-kit.
There is NO Outlook 9. The versions of Outlook are 95, 97, 98 and 2000. When I say REFERENCE Outlook 9, I mean you need a reference in VB to the Outlook 9 object model. That is why your getting the error message your getting.
If you don't know how to reference anything, then you need to spend more time learning VB because that is a basic concept.
Using Outlook is something to think about down the road.
John
-
Aug 8th, 2001, 06:21 AM
#15
PowerPoster
I wouldnt think you'd have to be even a good programmer to attempt (successfully or otherwise) to write a virus. Hope this isn't the case.
-
Aug 8th, 2001, 06:31 AM
#16
Member
It does sound suspiciously like a virus. Personally I don't know why someone would write one They have caused me so many headaches . But, on the upside of it I have gotten paid for takeing viruses out of computers.
Real knowledge is to know the extent of ones ignorance.
-
Aug 8th, 2001, 06:39 AM
#17
Retired VBF Adm1nistrator
Re: Outlook...
Originally posted by Norkis
Hi,
Can anybody give me a code how to do this:
Catch all emails adressers from outlook.
Sent to all catched emails message with app.exe
Can anybody help me???
Please.
Remove the pleasantries, and its the technical description of the loveletter virus.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 8th, 2001, 06:44 AM
#18
Fanatic Member
A tad suspicious, isn't it?
You definitely don't have to be much of a programmer to write a virus. I've seen the source code for the loveletter, and there's nothing there that even I couldn't do...
-
Aug 8th, 2001, 06:56 AM
#19
Fanatic Member
Really ??? I've never seen the code for a virus of any type. I always figured they were something the average idiot couldn't do.
Last time I post Outlook code. 
John
-
Aug 8th, 2001, 07:00 AM
#20
Retired VBF Adm1nistrator
The code for the loveletter virus is pretty much so everything posted on this page. It also makes copies of itself and what not, but thats basically it.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 8th, 2001, 07:11 AM
#21
Fanatic Member
I think the hardest thing about writing viruses is probably finding a way to release them into the wild without having the FBI turn up on your doorstep a week later and terrify your mum.
... and no, that doesn't mean I've ever tried.
-
Aug 8th, 2001, 10:21 AM
#22
Thread Starter
Hyperactive Member
Hei you all!!!
I'm making not a virus.
I'm making the program for advertisement.
So anybody would help me?
-
Aug 8th, 2001, 10:33 AM
#23
Fanatic Member
From the original description, I've already posted 90% of what you need. The only other help anyone could give you is to actually write the entire program for you. That I won't do.
You need to study the code I posted and finish the rest of the program.
John
-
Aug 8th, 2001, 10:35 AM
#24
PowerPoster
Norkis,
Just a suggestion .. I'd look for another way to advertise. Even if it isnt your intent to write a virus you could end up with something that causes the same effect.
Just some thoughts.
-
Aug 8th, 2001, 11:08 AM
#25
Fanatic Member
isn't your code supposed to be:?
VB Code:
ReDim Preserve aPAB(i - 1, 2)
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
-
Aug 8th, 2001, 11:33 AM
#26
Fanatic Member
your code doesn't work for me either
i sent a message to myself, and it never arrived
don't you need to specify some kind of server or something to send the mail to? i don't really know that much about this stuff, im trying to learn it myself.
it gets through the code just fine, but the message never arrives in my inbox
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
-
Aug 8th, 2001, 03:26 PM
#27
Fanatic Member
The Send Mail code requires that Outlook (2000 tested, should work with 98) be setup and working. If you can send with Outlook, this code should work fine.
The ns.Logon uses the Default profile, which for home use should be fine. This VB code uses the server listed in that profile/account.
Was your mail bounced back ???
Yes...the aPab() needs ReDim in front of it. Missed that somehow but checked all other code and it's all there.
John
-
Aug 8th, 2001, 05:11 PM
#28
Fanatic Member
ok, thanx
i only have outlook express working, whether this matters or not.
anyways, can this be used if the user doesn't have outlook and i just send them the MSOUTL9.OLB file?
and since they wouldn't have an account, would it be just as easy to set up my own account through code and then use that?
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
-
Aug 8th, 2001, 05:59 PM
#29
Fanatic Member
Sorry, that code only works with the full version of Outlook. From what I know, Outlook Express is a "limited" version that is a whole different ball game as far as controlling thru VB.
You can try but I doubt VERY much if sending anyone that file will help.
John
-
Aug 9th, 2001, 07:02 AM
#30
Thread Starter
Hyperactive Member
Thank you.
Your code works.
I have one more question:
This code only quere letters to outbox.
How with out any masage start sending these letters for outlook is conection is avaible?
And how to determe then sent is finished?
-
Aug 10th, 2001, 05:56 AM
#31
Fanatic Member
In Outlook, you need to go to Tool-Options and set Outlook to send mail immediatley if connected.
To actually "dial-up" automatically and send , you need to set the Internet Explorer settings to auto-dial and use the following function to dial-up the DEFAULT ISP providor you have on your system. To set IE, right click on the icon and select Properties. Then select the Connections tab. Make sure you have a default profile that works and 'Always dial my default connection' is selected. Make sure you call the following function BEFORE you do anything else with Outlook.
Private Declare Function InternetAutodialHangup Lib "wininet.dll" _
(ByVal dwReserved As Long) As Long
Private Declare Function InternetAutodial Lib "wininet.dll" _
(ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1 '<-- makes user hit enter on connect dialog
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2 '<--- does it auto
'To automatically start dialling Internet connect
If InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0) Then
DoEvents
Else
MsgBox "Unable to connect to the Internet", vbCritical
Exit Sub
End If
' to dis-connect
If InternetAutodialHangup(0) Then
DoEvents
Else
MsgBox "Unable to dis-connect from the Internet", vbCritical
Exit Sub
End If
John
-
Aug 10th, 2001, 06:16 AM
#32
Frenzied Member
Originally posted by Norkis
Hei you all!!!
I'm making not a virus.
I'm making the program for advertisement.
So anybody would help me?
cool... no virus just spam
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|