hello, i am fairly new to all this. i have a contact form in a app we have. i
want to grab the email address from the form and open up Outlook, have the
address already in the .to and outlook just waiting for the user to input
something in the Body and to send it. currently my code goes some of the way
but not all.

oOutlook = createobject("Outlook.Application")
#Define olFolderdisplaynormal 0
oNameSpace = oOutlook.GetNameSpace("MAPI")
oExplorer = oOutlook.Explorers.add (oNameSpace.Folders[1],
olFolderDisplayNormal)
oExplorer.Activate()
#define olMailItem 0
oMailitem = oOutlook.createitem(olMailitem)
WITH oMailitem
.subject = "This is my Test Button"
.to = ("what do i put here??? ")
endwith
oMailItem.save()

i have tried the _miscbtn class in vfp6 and it does it, only it places the
entire form contents in the Body of the message. its easy to pull addresses
from the contacts folder but i cant from my form.
thank you in advance for your help.
Tom

RE: Grabbing an email Address from a Form by Tom

Tom
Fri Mar 18 15:29:02 CST 2005

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 David

David
Sun Mar 20 11:45:59 CST 2005

Tom,

Check Outlook to see if it has a Send Immediately flag. I know that Outlook
Express has this option and it controls whether or not the send happens
instantly or is delayed until the next send/recieve pass is made.

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro

"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 Paul

Paul
Sun Mar 20 23:08:47 CST 2005

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
Sun Mar 20 23:36:10 CST 2005

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 Tom

Tom
Mon Mar 21 09:25:02 CST 2005

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 Tom

Tom
Mon Mar 21 09:31:09 CST 2005

One other question, how can i ensure that the text entered is a valid e-mail.
anyway to set the property of my text box to know? johndoe@ddd.com?


"Tom" wrote:

> 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
Mon Mar 21 15:20:33 CST 2005

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 TonySper

TonySper
Tue Mar 22 18:45:30 CST 2005

Fred,
Is it possible to use variables for the TO, CC, BCC, and
Attachments.Add???
Maybe even a field in a database like tryit.email would be the email
address
Would you need an absolute location for the text file??
TonySper

"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:eVC3QvlLFHA.2492@TK2MSFTNGP14.phx.gbl...
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 19:28:09 CST 2005

Yes, you can use variables for any of the property values. You need to
provide a full path to the file as it's not going to know anything about
your current settings in VFP, because essentially, you're no longer running
in VFP when it tries to add the attachement. It's got to know how/where to
find the file completely on it's own.

--
Fred
Microsoft Visual FoxPro MVP


"TonySper" <tsperduti@bellsouth.net> wrote in message
news:K_20e.69378$%Y4.56735@bignews6.bellsouth.net...
> Fred,
> Is it possible to use variables for the TO, CC, BCC, and
> Attachments.Add???
> Maybe even a field in a database like tryit.email would be the email
> address
> Would you need an absolute location for the text file??
> TonySper
>
> "Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
> news:eVC3QvlLFHA.2492@TK2MSFTNGP14.phx.gbl...
> 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 TonySper

TonySper
Wed Mar 23 11:47:50 CST 2005

Fred,
Thanks. I will play around with it and see what I can do. I understand
about having to give the full path to the file. I guess what I have to
do then is to always send the file with a fixed name to the same
folder before I call up the email.
TonySper

"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:%23TCvRe0LFHA.2492@TK2MSFTNGP14.phx.gbl...
Yes, you can use variables for any of the property values. You need
to
provide a full path to the file as it's not going to know anything
about
your current settings in VFP, because essentially, you're no longer
running
in VFP when it tries to add the attachement. It's got to know
how/where to
find the file completely on it's own.

--
Fred
Microsoft Visual FoxPro MVP


"TonySper" <tsperduti@bellsouth.net> wrote in message
news:K_20e.69378$%Y4.56735@bignews6.bellsouth.net...
> Fred,
> Is it possible to use variables for the TO, CC, BCC, and
> Attachments.Add???
> Maybe even a field in a database like tryit.email would be the email
> address
> Would you need an absolute location for the text file??
> TonySper
>
> "Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
> news:eVC3QvlLFHA.2492@TK2MSFTNGP14.phx.gbl...
> 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.
>>> >
>>> >
>>>
>>>
>>>
>
>
>