rog1111 08-01-2001, 10:50 AM Hi all
My program calls the following subroutine once only :
Option Explicit
Dim OL As Outlook.Application
Dim MS As Outlook.MailItem
Dim datebit As Variant
__________________________
Private Sub emailme()
Set OL = New Outlook.Application
Set MS = OL.CreateItem(olMailItem)
With MS
.To = txtemail.Text ' Specified recipient on form
.CC = ""
.BCC = ""
.Subject = "Results for " & Date ' todays results
.Body = "Good luck trader !"
.Attachments.Add ("C:\My Documents\FinalResults" & datebit)
.Send
End With
Outlook.Application.Quit
Set MS = Nothing
End Sub
____________________________
OK fine, it works, EXCEPT that it sends 2 duplicate emails !
I have checked all the Outlook settings and can see no reason for this......
Any suggestions ?
TIA
Roger
"..he looked at the clock & saw that it was 11:11, how odd.."
sethindeed 08-01-2001, 12:10 PM Here is the way I am doing my Outlook Email delivery :
I declare my stuff differently...
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
.To=txtemail.text
.Subject="results for " &Date ' todays results
.Body="Good Luck Trader"
.Attachments.add ("C:\My Documents\FinalResults" & datebit)
.Send
End With
Set objMailItem = Nothing
Set objOutlook = Nothing
Try not to initialize BCC and CC to "". Maybe it is reading it as a duplicate of your address. Anyway, I know this routine works fine and send only one copy. If it is still sending a duplicate, look at your routine or at the content of your txtemail.text.
Hope it helps !
rog1111 08-01-2001, 12:43 PM Sethindeed
The declarations look the same ?
I took out the .CC and .BCC - no difference. Checked code & textbox & everything looks fine. Also, I gave the program to someone else to run, and I received duplicate emails, so its not my copy of Outlook !
I'm puzzled ?
Regards
Roger
"..he looked at the clock & saw that it was 11:11, how odd.."
niktesla 08-01-2001, 02:05 PM I pasted the code in an app and only got one e-mail.
I would change the last lines to
'Outlook.Application.Quit
Set MS = Nothing
Set OL = Nothing
That way if you have outlook open while you run this code it won't try to close it.
Brian T. Wiehoff
Why not try using MAPI to send your email?
It would work just as well, as it links in with any email program, making it more versatile.
I will attatch a demo, just in case you think i am crazy or something.
Only one thing in life is certain - you won't get out of it alive
rog1111 08-05-2001, 12:54 PM Thanks all
I have tried the MAPI method, which works OK, but I still get my duplicate email !! I'm positive that my code doesnt call the email sub more than once......
Dunno on this one......!!
Roger
"..he looked at the clock & saw that it was 11:11, how odd.."
If you still get a duplicate, then it is to do with the way your email serveritself is set up - i tried that code my self and it worked fine! :)
You probably have your email server (Outlook etc) setup to send amultiple copies to ensure that the email arrives OK or something.
TrisM
Only one thing in life is certain - you won't get out of it alive
Spike 08-06-2001, 09:11 PM I was using the MAPI with outlook express. On the users computer, there are multible identiys. When i tell the MAPIsession1.signoff, it does not log off the identity, even though the username and password are provided. Is it possible to log off the identity?
Spike
it should log off with the mapisession1.signoff command.
Other than that, you could try setting the mapisession1.username each time a mail is sent.
ie mapisession1.username = bob@bob.com
then put mapisession1.username = ""
thats all i can think of at the moment.....
Only one thing in life is certain - you won't get out of it alive
Spike 08-07-2001, 04:26 PM That is what i am doing right now, but it still doesnt want to log off the identity. Anyone else have any ideas?
Spike
rog1111 08-08-2001, 08:11 AM I had a look at my Outlook settings, but no clues there, so in desperation I've reinstalled it & hey presto - no more duplicate emails !!
Its still strange though......?
My only objection to the MAPI method is the necessity to include extra OCX components with the project, but I suppose that its wise in case Outlook isnt the default email program.....
Any idea what will happen with AOL mail ?
Regards
Roger
"..he looked at the clock & saw that it was 11:11, how odd.."
Thinker 08-08-2001, 08:19 AM To imagine what might happen with AOL mail just imagine what AOL might really stand for. Two things come to mind.
1. America Outa Luck
2. America Off Line
I think therefore I am... sometimes right. images/icons/wink.gif
Anyway, if you use a special setup creater program, like Wise installer, it packs everything you need into one setup file, and you dont have to worry about the extra OCX files.
You really cant use outlook mail object if you are distributing the program at all, as not everyone has it!
Tris
Only one thing in life is certain - you won't get out of it alive
CornMaster 08-08-2001, 11:41 AM I realize that this has nothing to do with the discussion but....
What AOL really means:
1) Almost OnLine
2) Always OffLine
3) AOheLl (AOHELL)
;-)
~Complex Solutions to Simple Problems!!~
CornEmpire Ruler
http://www.cornempire.com
rog1111 08-08-2001, 01:21 PM It's that bad eh ?!!
AOL UK seems to be well accepted, perhaps because they were the first ISP here to offer a genuine unmetered (56K) calls option (I am excluding Freeserve - rubbish connections...).
Its a shame about their restrictive email practices though - making it harder for all those budding VB programmers !
AnyOtherLaments ?!
Regards
"..he looked at the clock & saw that it was 11:11, how odd.."
dpeso 11-29-2001, 02:54 PM I keep getting error 429 for
Set OL = New Outlook.Application
can anybody tell me how to correct this?
divil 11-30-2001, 05:14 AM Heres an idea, you probably won't like it. I recently wrote my own class to interface with SMTP servers and send email that way. My app has no dependancies other than the winsock control. Its quite satifsying if you go to all the trouble.
ChiefRedBull 11-30-2001, 11:56 AM Which SMTP servers do you use divil?
I've been playing with SMTP for ages now, and I've yet to find a decent server that works every time, allows relaying to all domains, and is free to the public.
divil 12-03-2001, 08:20 AM When you subscribe to an ISP, in my experience, they give you access to their SMTP server for sending mail! Therefore I have always used the one my ISP gives me access to, since it is guaranteed to deliver.
ChiefRedBull 12-03-2001, 12:47 PM Cunning plan... I'll look into that. Flipping NTL though... tight bunch of £$(*%^. images/icons/wink.gif
|