Article: 179837 of microsoft.public.fox.programmer.exchange
From: "Fred Taylor" <ftaylor@mvps.org!REMOVE>
References: <F3C056F1-CCF4-4639-874F-568BC1DBAE15@microsoft.com> <64012719-9E6A-410C-981F-9B584CC20FC4@microsoft.com> <eHhxRQdLFHA.3184@TK2MSFTNGP09.phx.gbl> <e0H8ifdLFHA.1396@TK2MSFTNGP10.phx.gbl> <9D44133E-26DA-49CD-A56D-2C399F3346DC@microsoft.com>
Subject: Re: Grabbing an email Address from a Form
Date: Mon, 21 Mar 2005 14:20:33 -0700
Lines: 97
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-Antivirus: avast! (VPS 0511-1, 03/17/2005), Outbound message
X-Antivirus-Status: Clean
Message-ID: <eVC3QvlLFHA.2492@TK2MSFTNGP14.phx.gbl>
Newsgroups: microsoft.public.fox.programmer.exchange
NNTP-Posting-Host: cpe-66-1-71-238.az.sprintbbd.net 66.1.71.238
Path: news.btopenworld.com!btnet-feed3!news-peer0-test!btnet!newshosting.com!nx01.iad01.newshosting.com!130.191.3.6.MISMATCH!newshub.sdsu.edu!msrtrans!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
Xref: news.btopenworld.com microsoft.public.fox.programmer.exchange:179837

This is the code I use:

olMailItem = 0
oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(olMailItem)
With oEmailItem
.To = "somebody@anywhere.com"
.CC = "somebodyelse@aywhere.com"
.BCC = "newperson@anywhere.com"
.Attachments.Add("c:\somefile.txt")
.Subject = "This is the Subject"
.Send()
ENDWITH
oOutLookObject=null


--
Fred
Microsoft Visual FoxPro MVP


"Tom" <Tom@discussions.microsoft.com> wrote in message
news:9D44133E-26DA-49CD-A56D-2C399F3346DC@microsoft.com...
> using the .send() will send it right away, However it continues to send
> messages while you are typing in the Body.
>
> so i have to use the .display, and the user clicks on send, if outlook is
> closed the message goes to the outbox and waits until they open it. thats
> the
> problem.
>
> what about this, if Outlook is closed should i open it and leave it open?
> right now if its open, i create anothe instance of it then close it when
> im
> done. is there no way to set some of the advanced e-mail props from code?
>
> thanks again
>
> Tom
>
>
> "Fred Taylor" wrote:
>
>> I don't think you have to press "Send", but you do have to click "OK",
>> that
>> someother program is trying to send mail. You can't do it undetected
>> behind
>> the scenes anymore, at least not since Office 2K/Sp2?
>>
>> --
>> Fred
>> Microsoft Visual FoxPro MVP
>>
>>
>> "Paul Pedersen" <no-reply@swen.com> wrote in message
>> news:eHhxRQdLFHA.3184@TK2MSFTNGP09.phx.gbl...
>> >I think with the newer versions of Outlook, it's no longer possible to
>> >tell
>> >it to Send, even if Outlook is running. You have to get the user to
>> >click
>> >the Send button on Outlook. Someone tell me if I'm wrong.
>> >
>> > I think this was done for security reasons - there were too many
>> > viruses &
>> > such hijacking Outlook and sending emails without the users consent.
>> >
>> >
>> >
>> >
>> > "Tom" <Tom@discussions.microsoft.com> wrote in message
>> > news:64012719-9E6A-410C-981F-9B584CC20FC4@microsoft.com...
>> >> aOk i answered my own question with the Following Code.
>> >>
>> >> oOutlook = createobject("Outlook.Application")
>> >> #define olMailItem 0
>> >> oMailitem = oOutlook.createitem(olMailitem)
>> >> WITH oMailitem
>> >> .to = lagstat.pemail
>> >> endwith
>> >> oMailitem.display
>> >>
>> >> However it raised another. when a person sends in the above code, and
>> >> outlook is not open, it waits to actually send the item untill they
>> >> open
>> >> up
>> >> outlook. i need the mails to send when the user hits the send button,
>> >> even if
>> >> Outllok is Closed.
>> >>
>> >> Thanks again.
>> >
>> >
>>
>>
>>

Re: Grabbing an email Address from a Form by Fred

Fred
Tue Mar 22 15:48:12 CST 2005

If you need to have some text in the body, then you can either build up the
.Body property before you .Send() it via code, or you could load it with a
string containing the text from a file.

.Body = "this is the body of the message"

or

.Body = FILETOSTR("c:\somepath\messagebody.txt")

--
Fred
Microsoft Visual FoxPro MVP


"Alan Pengelly" <aNOpengellySPAM@cix.co.uk> wrote in message
news:memo.20050322211207.1824H@apengelly.compulink.co.uk...
>
> Article: 179837 of microsoft.public.fox.programmer.exchange
> From: "Fred Taylor" <ftaylor@mvps.org!REMOVE>
> References: <F3C056F1-CCF4-4639-874F-568BC1DBAE15@microsoft.com>
> <64012719-9E6A-410C-981F-9B584CC20FC4@microsoft.com>
> <eHhxRQdLFHA.3184@TK2MSFTNGP09.phx.gbl>
> <e0H8ifdLFHA.1396@TK2MSFTNGP10.phx.gbl>
> <9D44133E-26DA-49CD-A56D-2C399F3346DC@microsoft.com>
> Subject: Re: Grabbing an email Address from a Form
> Date: Mon, 21 Mar 2005 14:20:33 -0700
> Lines: 97
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
> X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
> X-RFC2646: Format=Flowed; Original
> X-Antivirus: avast! (VPS 0511-1, 03/17/2005), Outbound message
> X-Antivirus-Status: Clean
> Message-ID: <eVC3QvlLFHA.2492@TK2MSFTNGP14.phx.gbl>
> Newsgroups: microsoft.public.fox.programmer.exchange
> NNTP-Posting-Host: cpe-66-1-71-238.az.sprintbbd.net 66.1.71.238
> Path:
> news.btopenworld.com!btnet-feed3!news-peer0-test!btnet!newshosting.com!nx01.iad01.newshosting.com!130.191.3.6.MISMATCH!newshub.sdsu.edu!msrtrans!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
> Xref: news.btopenworld.com microsoft.public.fox.programmer.exchange:179837
>
> This is the code I use:
>
> olMailItem = 0
> oOutLookObject = CreateObject("Outlook.Application")
> oEmailItem = oOutLookObject.CreateItem(olMailItem)
> With oEmailItem
> .To = "somebody@anywhere.com"
> .CC = "somebodyelse@aywhere.com"
> .BCC = "newperson@anywhere.com"
> .Attachments.Add("c:\somefile.txt")
> .Subject = "This is the Subject"
> .Send()
> ENDWITH
> oOutLookObject=null
>
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "Tom" <Tom@discussions.microsoft.com> wrote in message
> news:9D44133E-26DA-49CD-A56D-2C399F3346DC@microsoft.com...
>> using the .send() will send it right away, However it continues to send
>> messages while you are typing in the Body.
>>
>> so i have to use the .display, and the user clicks on send, if outlook is
>> closed the message goes to the outbox and waits until they open it. thats
>> the
>> problem.
>>
>> what about this, if Outlook is closed should i open it and leave it open?
>> right now if its open, i create anothe instance of it then close it when
>> im
>> done. is there no way to set some of the advanced e-mail props from code?
>>
>> thanks again
>>
>> Tom
>>
>>
>> "Fred Taylor" wrote:
>>
>>> I don't think you have to press "Send", but you do have to click "OK",
>>> that
>>> someother program is trying to send mail. You can't do it undetected
>>> behind
>>> the scenes anymore, at least not since Office 2K/Sp2?
>>>
>>> --
>>> Fred
>>> Microsoft Visual FoxPro MVP
>>>
>>>
>>> "Paul Pedersen" <no-reply@swen.com> wrote in message
>>> news:eHhxRQdLFHA.3184@TK2MSFTNGP09.phx.gbl...
>>> >I think with the newer versions of Outlook, it's no longer possible to
>>> >tell
>>> >it to Send, even if Outlook is running. You have to get the user to
>>> >click
>>> >the Send button on Outlook. Someone tell me if I'm wrong.
>>> >
>>> > I think this was done for security reasons - there were too many
>>> > viruses &
>>> > such hijacking Outlook and sending emails without the users consent.
>>> >
>>> >
>>> >
>>> >
>>> > "Tom" <Tom@discussions.microsoft.com> wrote in message
>>> > news:64012719-9E6A-410C-981F-9B584CC20FC4@microsoft.com...
>>> >> aOk i answered my own question with the Following Code.
>>> >>
>>> >> oOutlook = createobject("Outlook.Application")
>>> >> #define olMailItem 0
>>> >> oMailitem = oOutlook.createitem(olMailitem)
>>> >> WITH oMailitem
>>> >> .to = lagstat.pemail
>>> >> endwith
>>> >> oMailitem.display
>>> >>
>>> >> However it raised another. when a person sends in the above code, and
>>> >> outlook is not open, it waits to actually send the item untill they
>>> >> open
>>> >> up
>>> >> outlook. i need the mails to send when the user hits the send button,
>>> >> even if
>>> >> Outllok is Closed.
>>> >>
>>> >> Thanks again.
>>> >
>>> >
>>>
>>>
>>>
>
>
>
>