Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

outlook and vfp

Status
Not open for further replies.

HERVEC1

Programmer
Sep 13, 2002
11
US
I would like to know how i can send several attachments with outlook and vfp in the same email ... thanks
 
Herve

This will do it for you:
Code:
#DEFINE MAILITEM 0
#DEFINE IMPORTANCELOW 0
#DEFINE IMPORTANCENORMAL 1
#DEFINE IMPORTANCEHIGH 2

oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(MAILITEM)

WITH oEmailItem
   .Recipients.Add("me@canada.com") && uses the Recipients collection
   .Subject = "Automation sample"
   .Importance = IMPORTANCENORMAL
   .Body = "This is easy!"
   .Attachments.Add("c:\netlog.txt") 
   .Attachments.Add("c:\new.bmp")
   .Send
ENDWITH

RELEASE oEmailItem
RELEASE oOutLookObject

You have to make sure the path of the files is correct, otherwise it will not give you an error.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
thank you for your answer;

I don't use "creatobject" and when I wnat to use your program , I have an error at this line .

I don't know why !


I use this prg :

** IN INIT


WITH THISFORM
* Signon to mail
.oleSession.Signon

* If the session ID is not valid, do not allow the form to load
IF .oleSession.SessionID > 0
.oleMessage.SessionID = .oleSession.SessionID
ELSE
WAIT WINDOW NOWAIT "error Login"
RETURN .F.
ENDIF

* Start a new message
.oleMessage.Compose
.txtrecipient.value="herve@panterga.com"
.txtSubject.value="samples"
ENDWITH





WITH THISFORM

.oleMessage.AttachmentPathname = "c:\listing.pdf"

* If the subject, note text, or recipient list is empty, a Compose
* message dialog will be displayed.
IF EMPTY(.txtSubject.Value) OR EMPTY(.edtNoteText.Value) .oleMessage.Send(1)
ELSE
.oleMessage.Send(0)
ENDIF

* Reset all values
.txtRecipient.Value = ""
.lstRecipients.Clear
.txtSubject.Value = ""
.edtNoteText.Value = ""

* Start a new message
.oleMessage.Compose
ENDWITH


have you an idea ??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top