-
how do I attach a file to the email.
I am using the CDO libary,
I dimmed the following:
dim objSession as MAPI.Session
dim objMessage as MAPI.Message
Create the Session:
Set objSession = CreateObject("Mapi.Session")
log onto session:
objSession.Logon SETTINGS
strUserName = objSession.CurrentUser
created the message and fill in its properties:
Set objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = txtSubject.Text
objMessage.Text = txtMessage.Text
objMessage.Attachments.Add ??????
I don't know how assign and load the file I want into the message.
-
just a suggestion
I've messed with CDO before and I found that for MAPI stuff it's hard to beat, but if you're looking to do SMTP/POP3; I would download AspEmail (http://www.persits.com/aspemail.exe) because it's free (I think) and distributable as one .DLL and it does everything (including attachments) really easily.
-
???
the app uses the users outlook or ms exhange setting,
all I need to do is assign the attachment to the file but she won't work.
-
Outlook object lib
If the all the users have outlook why not swap to using the outlook object library? You can then use the Attachment object of the MailItem.
I can't help with the MAPI stuff (got some examples but not got round to looking at them!), we needed something like yesterday and the outlook lib was quickest way to get a solution.
-
This is how I did it.
'''''''''''''''''''''''
Dim AttachmentFile As String
MAPIMessages1.SessionID = MAPISession1.SessionID
With MAPIMessages1
AttachmentFile="C:\Test\Test.txt"
.AttachmentPathName = AttachmentFile
End With
'''''''''''''''''''''''''
Hope, it'll help.
-
Hi there,
i had a problem with attachments too. after day´s :mad: of searching i found out that you need for every attachment a character in the messagebody.
wolf