Vikas-
Thanks you. Your quick response is much appreciated and worked beautifully.
Regards,
Kristi
Main Topics
Browse All TopicsHere is an example of code that I am using to send mail via outlook redemption in my application. This is tested / working code. My question is how is it that I may add an attachment to this email? My initial thoughts were:
oleSafeMailItem.Attachment
However, this is not correct. Can someone please point me in the right direction?
Example:
oleOutlook = create oleobject
rc = oleOutlook.ConnectToNewObj
If rc = 0 Then
oleNameSpace = oleOutlook.GetNameSpace("M
oleNameSpace.Logon("", "", true, true)
oleSafeMailItem = create oleobject
rc = oleSafeMailItem.ConnectToN
If rc = 0 Then
oleTmp = create oleobject
oleTmp = oleOutlook.CreateItem(0)
oleSafeMailItem.Item = oleTmp
oleSafeMailItem.Recipients
oleSafeMailItem.Recipients
oleSafeMailItem.Subject = ls_subject
oleSafeMailItem.Send
Else
MessageBox("Mail Error", &
"Your email could not be sent. Please contact IT.~r~n" + &
"The SafeMailItem - ConnectToNewObject~r~n" + &
"failed with a return code of " + String(rc) + ".", &
StopSign!, &
Ok!)
End If
Else
MessageBox("Mail Error", &
"Your email could not be sent. Please contact IT.~r~n" + &
"The Outlook Application - ConnectToNewObject~r~n" + &
"failed with a return code of " + String(rc) + ".", &
StopSign!, &
Ok!)
End If
Regards,
Kristi
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: Vikas_DixitPosted on 2005-11-03 at 14:09:42ID: 15220936
Hi Kristi,
s.Add(ls_f ilename, 1,1,"MY ATTACHMENT")
ts ame, 1,1,"MY ATTACHMENT")
As per MSDN :
Add(Source, Type, Position, DisplayName)
Source - File name ,
Type :
olByReference 4
olByValue 1
olEmbeddedItem 5
olOLE 6
Position Optional Long. The position of the attachment within the body text of the message.
So Have you tried :
oleSafeMailItem.Attachment
or
OleObject myAttachments
myAttachments =oleSafeMailItem.Attachmen
myAttachments.Add(ls_filen
Regards,
Vikas Dixit