SaadDani
asked on
MAPI controls
Is it possible to send an attached file using MAPI Message control?
If yes, how?
If yes, how?
Yup - its possible. You just need devel access to MSMAPI32.OCX - you will get this if you install VB5 or 6. Simply Insert, ActiveXControl and select MSMAPI32.OCX.
Search the access area for "MAPI" and you can find the reams of code I have posted in the past.....
HTH
Simon
Search the access area for "MAPI" and you can find the reams of code I have posted in the past.....
HTH
Simon
Check
https://www.experts-exchange.com/jsp/qShow.jsp?ta=msaccess&qid=10294755
https://www.experts-exchange.com/jsp/qShow.jsp?ta=vbcontrols&qid=10200168
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10202867
https://www.experts-exchange.com/jsp/qShow.jsp?ta=msaccess&qid=10228787
HTH
Simon
https://www.experts-exchange.com/jsp/qShow.jsp?ta=msaccess&qid=10294755
https://www.experts-exchange.com/jsp/qShow.jsp?ta=vbcontrols&qid=10200168
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10202867
https://www.experts-exchange.com/jsp/qShow.jsp?ta=msaccess&qid=10228787
HTH
Simon
From the web:
"MAPI makes adding attachments to your email messages very simple. You don't need to encode your binary file using MIME or UUENCODE, instead the MAPIMessages control will handle all the encoding for you. (If you've ever seen the MIME specification, you will be VERY grateful for this feature.)"
NOTE:Please change the RecipAddress. I don't want to get a million Autoexec.bat files!
Private Sub Form_Load()
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.RecipAddress = "abstractvb@home.com"
MAPIMessages1.MsgSubject = "Here is my Autoexec"
MAPIMessages1.MsgNoteText = "Below you will find the file."
'Add the Attachment at the end of the message
MAPIMessages1.AttachmentPo sition = Len(MAPIMessages1.MsgNoteT ext)
'Set the type to a data file
MAPIMessages1.AttachmentTy pe = mapData
'Give it a name
MAPIMessages1.AttachmentNa me = "Autoexec File"
'Specify what file to send
MAPIMessages1.AttachmentPa thName = "c:\autoexec.bat"
MAPIMessages1.Send True
MAPISession1.SignOff
End Sub
Or, you can go to
http://support.microsoft.com/support/kb/articles/Q186/1/48.ASP
"MAPI makes adding attachments to your email messages very simple. You don't need to encode your binary file using MIME or UUENCODE, instead the MAPIMessages control will handle all the encoding for you. (If you've ever seen the MIME specification, you will be VERY grateful for this feature.)"
NOTE:Please change the RecipAddress. I don't want to get a million Autoexec.bat files!
Private Sub Form_Load()
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.RecipAddress
MAPIMessages1.MsgSubject = "Here is my Autoexec"
MAPIMessages1.MsgNoteText = "Below you will find the file."
'Add the Attachment at the end of the message
MAPIMessages1.AttachmentPo
'Set the type to a data file
MAPIMessages1.AttachmentTy
'Give it a name
MAPIMessages1.AttachmentNa
'Specify what file to send
MAPIMessages1.AttachmentPa
MAPIMessages1.Send True
MAPISession1.SignOff
End Sub
Or, you can go to
http://support.microsoft.com/support/kb/articles/Q186/1/48.ASP
ASKER
There is a problem with the line
MAPIMessages1.Send True
what to do?
MAPIMessages1.Send True
what to do?
What error message do you get?
ASKER
Hello
the error message is
RunTime Error '32002'
Unspecified Failure has occured
bye
the error message is
RunTime Error '32002'
Unspecified Failure has occured
bye
Are you running on Windows NT?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you read this link I gave???
"PRB: Error 32002 Working with
Attachments in MAPI Controls"
http://support.microsoft.com/support/kb/articles/Q186/1/48.ASP
Take a look at:
http://support.microsoft.com/support/kb/articles/Q173/8/53.ASP
"PRB: Error 32002 Working with
Attachments in MAPI Controls"
http://support.microsoft.com/support/kb/articles/Q186/1/48.ASP
Take a look at:
http://support.microsoft.com/support/kb/articles/Q173/8/53.ASP
There are many other alternatives, simplest of which is the sendobject command. You can also purchase a control that works with Access or write your own interface.
I could give you a lot more info if I knew what version of Access this was for.
Jim.